IonicWind Software

IWBasic => General Questions => Topic started by: Brian on April 28, 2012, 06:13:21 AM

Title: OpenWindow
Post by: Brian on April 28, 2012, 06:13:21 AM
Hi,

Now I'm sure I've seen this before somewhere, but what's the best way of opening
a window according to the user's screen size, and whether or not there
is a Taskbar showing, without the user having to resize the window manually?

Brian
Title: Re: OpenWindow
Post by: ZeroDog on April 28, 2012, 09:38:16 PM
I've tried various things, unfortunately, the taskbar seems to be a fickle thing.  For example, the following works just fine, so long as the taskbar is at the bottom of the screen (regardless of how big it is), however, as soon as you move the taskbar to the top or sides of your screen, it has issues.

DECLARE import,SystemParametersInfoA(uAction:INT, uParam:INT, lpvParam:POINTER, fuWinIni:INT),INT
CONST SPI_GETWORKAREA = 48
def workrect:winrect
systemparametersinfoA(SPI_GETWORKAREA, 0,workrect,0)

def win:window
openwindow win, workrect.left, workrect.top, workrect.right,workrect.bottom, @CAPTION, 0, "SystemParametersInfo Test", &winproc

run=1
waituntil run=0
end

sub winproc(),int
select @class
case @idclosewindow
run=0
endselect
return 0
endsub
Title: Re: OpenWindow
Post by: Andy on April 28, 2012, 10:26:36 PM
Hi Brian,

Hope you're well, have a look at the attachment - it's one of the browser examples.

It changes it's screen size to fit the users screen, I changed it so it maximizes to full screen. I moved the taskbar around the screen i.e. top, left, right, and bottom, and I think maybe this is what your are after.

Larry is the expert on this code but there is a sub routine called resizeall  used after the openwindow command.

Alternatively, there is also a command:
You could use the GETSCREENSIZE screenW,screenH to find the size of the screen and use
openwindow  win,0,0, screenW,screenH .............


Hope some of this helps,
Andy.
:)


Title: Re: OpenWindow
Post by: ZeroDog on April 28, 2012, 11:13:27 PM
GETSCREENSIZE will return the current screen resolution, and will not take the user's taskbar into consideration.
Title: Re: OpenWindow
Post by: Andy on April 29, 2012, 03:48:33 AM
Thanks ZD,

I think then the browsertest attachment example might be the way to go for Brian?

Andy.
Title: Re: OpenWindow
Post by: Brian on April 29, 2012, 03:51:29 AM
Hi,

Thanks for your replies - just going to have a look at them. Meanwhile, what I came
up with myself was:

DECLARE IMPORT,GetSystemMetrics(item:INT),INT
WINDOW win
GETSCREENSIZE screenW,screenH
OPENWINDOW win,0,0,screenW,screenH-GetSystemMetrics(13),@MINBOX|@MAXBOX|@SIZE,0,"Window Test",&main

This appears to allow for the taskbar at the bottom. What I haven't tested is whether
the taskbar is at any other place than the bottom of the screen

GETSCREENSIZE for me on it's own didn't allow for the taskbar

Brian
Title: Re: OpenWindow
Post by: Egil on April 29, 2012, 06:09:27 AM
Brian,
I no longer have any copies of EB/IWB on my computers, so I can not test this out myself. But after opening the program as shown in your last post, try GETCLIENTSIZE to see if it takes care of the taskbar position.

Good luck!

Egil
Title: Re: OpenWindow
Post by: ZeroDog on April 29, 2012, 07:41:54 PM
QuoteGetSystemMetrics(13)

I'm confused.  That would return the width of the cursor (CONST SM_CXCURSOR = 13):
QuoteSM_CXCURSOR,
SM_CYCURSOR
Width and height, in pixels, of a cursor. These are the cursor dimensions supported by the current display driver. The system cannot create cursors of other sizes.

If you are using GetSystemMetrics, you could use the following flags:
SM_CXMAXIMIZED,
SM_CYMAXIMIZED
Default dimensions, in pixels, of a maximized top-level window.

CONST SM_CXMAXIMIZED = 61
CONST SM_CYMAXIMIZED = 62


In theory, a maximized window should take the taskbar into account, regardless of it's position and size.

Title: Re: OpenWindow
Post by: LarryMc on April 29, 2012, 08:02:34 PM
Quote from: Egil on April 29, 2012, 06:09:27 AM
Brian,
I no longer have any copies of EB/IWB on my computers, so I can not test this out myself. But after opening the program as shown in your last post, try GETCLIENTSIZE to see if it takes care of the taskbar position.

Good luck!

Egil
GETCLIENTSIZE gets the client size of a window; not of the user's screen. ;)

Note: Load your IWB back up and come join us again.  We're here everyday. ;D

LarryMc