Re: [libertybasic] Pesky Pixels Part 2
----- Original Message -----
From: "keithchesworth" <keithchesworth@...>
Sent: Monday, January 31, 2005 1:21 PM
Subject: [libertybasic] Pesky Pixels Part 2
> Been playing about and getting my hands dirty in true engineering
> style and noticed a little weeze in one of the examples in the help files.
> There the displaywidth/height command was used as part of a thing to
> get the demo program to show the screen resolution when the program
> was run.
> Humm, cogs turned, ears emitted a suitable amount of smoke, steam, ash
> and clinker and I thought, "What would happen if Windowwidth/height
> were to be set to display?
> Lo and behold it was accepted and the program opened full screen.
> Cogs turned again and further suitable emmissions emerged and I came
> up with;
> UpperLeftX = DisplayWidth/4
> UpperLeftY = DisplayHeight/4
> WindowWidth = DisplayWidth/2
> WindowHeight= DisplayHeight/2
> BackgroundColor$ = "Yellow"
> Not a pesky Pixel in sight and a program which opens up in the centre
> of the desktop and using 50% of the desktop area, no matter what the res.
> Now I am wondering where I have missed something, because I have not
> seen this anywhere and Naturally if there are any other sneaky weezes
> to be had with sizing and positioning.
> Keith J Chesworth
If ,indeed, you are asking, "Why hasn't anyone come up with this before?".
I think that the problem here lies in the window design.
I create a window with 6 controls in it.
I get them all right where I want them.
Then when someone with a different screen
res runs my program, everything is crowded to
the upper left corner, or running off the right
and bottom sides. This is because controls are
normally located from the upper left corner.
It would take an enormous amount of time to
calculate all possible window-opening sizes and
proper placement for all six controls.
Now it is possible that using a screen res dependant
variable in the control location calculations you might
be able to minimize the amount of code it would take
to properly locate them. My guess is that for ease of
programming, most programmers hard code a window
size. This is not to say that the user couldn't resize the
window. I currently disable all window resizing except
'minimize' and 'restore', to prevent this sort of thing.