Author |
Topic: Window alignment (Read 620 times) |
|
Alincon
Full Member
member is offline
Posts: 147
|
|
Window alignment
« Thread started on: Nov 16th, 2016, 3:53pm » |
|
When I use this code, I expect the window to fill the screen and not leave any space on any side, but it seems not to work in LBB. Am I doing something wrong?
r.m.
Code:
WindowWidth = DisplayWidth: WindowHeight = DisplayWidth
UpperLeftX=0 : UpperLeftY=0
|
|
Logged
|
|
|
|
Rod
Full Member
member is offline
Gender:
Posts: 110
|
|
Re: Window alignment
« Reply #1 on: Nov 16th, 2016, 5:02pm » |
|
Windows has changed, it is broken across all implementations. Don't know why but it is not LBB specific.
I get a 7pixel border right and left and a 5pixel border at bottom.
|
« Last Edit: Nov 16th, 2016, 5:32pm by Rod » |
Logged
|
|
|
|
Jack Kelly
Full Member
member is offline
Gender:
Posts: 106
|
|
Re: Window alignment
« Reply #2 on: Nov 16th, 2016, 7:49pm » |
|
I get a full screen under Windows XP with LBB and JB. UpperLeftX=0: UpperLeftY=0 is not needed. WindowHeight = DisplayHeight, not DisplayWidth. This messes up JB but not LBB.
Code:NoMainWin
WindowWidth = DisplayWidth: WindowHeight = DisplayHeight
'UpperLeftX=0: UpperLeftY=0
open "Full Screen Window" for window as #win
#win "TrapClose [quit]"
wait
[quit]
close #win
end
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: Window alignment
« Reply #3 on: Nov 16th, 2016, 8:41pm » |
|
on Nov 16th, 2016, 3:53pm, Alincon wrote:When I use this code, I expect the window to fill the screen |
|
Part of the problem is that "fill the screen" isn't well-defined. For example, do you expect the right and left window borders to be visible or not? Do you expect the taskbar to cover part of the window or not? Do you expect the title bar to be visible or not?
In the case of a DIALOG, GRAPHICS or TEXT window, Liberty BASIC provides specific 'full screen' versions which you select by appending _FS to the window name. The window is resized so that it is slightly wider than the screen (so the left and right borders are not visible) but the height is somewhat less than the display height (so the taskbar does not cover any of the window). This is probably the best option for those window types.
For some reason the WINDOW type does not has a _FS option (I could easily add one in LBB); but you can achieve the same effect using STYLEBITS:
Code:NoMainWin
stylebits #win, _WS_MAXIMIZE, 0, 0, 0
open "Full Screen Window" for window as #win
#win "TrapClose [quit]"
wait
[quit]
close #win
end If you try to force a window to be 'full screen' by setting the WindowWidth and WindowHeight variables to the display dimensions something different happens. Specifically, the left and right borders are visible, because WindowWidth is inclusive of them; this is admittedly largely cosmetic. But more seriously, the window will extend to the bottom of the display underneath the taskbar which is probably undesirable and may confuse Windows.
So my recommendation is that if you want a 'full screen' window you should achieve it using the _FS suffix when it is available, and using STYLEBITS otherwise. The WindowWidth and WindowHeight variables should be reserved for when you want the window to be smaller than the screen.
For completeness I should add that it is also possible to create a genuinely 'full screen' window in which neither the title bar nor taskbar is visible. This can be achieved using API calls but is generally not to be encouraged except for special purposes such as video games.
Richard.
|
|
Logged
|
|
|
|
Alincon
Full Member
member is offline
Posts: 147
|
|
Re: Window alignment
« Reply #4 on: Nov 16th, 2016, 8:46pm » |
|
I'm embarrassed to say that this thread is due to programmer error. r.m.
|
« Last Edit: Nov 17th, 2016, 12:30am by Alincon » |
Logged
|
|
|
|
tsh73
Full Member
member is offline
Gender:
Posts: 210
|
|
Re: Window alignment
« Reply #5 on: Nov 17th, 2016, 07:08am » |
|
As they said - the only one who do not error is one that does nothing .
|
|
Logged
|
|
|
|
|