Liberty BASIC Help Online |
Size and Placement of Windows
NOTE: Beginning with Liberty BASIC v2.0 the placement of windows and dialog boxes is more or less the same. Previous versions had two different helpfile sections to describe how window and dialog placement worked.
The size and placement of any window can be set before it is opened. If no size and placement statements are specified before a statement to OPEN a window, Liberty BASIC will pick default sizes.
There are four special variables that can be set to select the size and placement of windows:
UpperLeftX
UpperLeftY
WindowWidth
WindowHeight
The width and the height of the display screen can be retrieved with these variables:
DisplayWidth
DisplayHeight
The values set for UpperLeftX and UpperLeftY determine the number of pixels from the upper-left corner of the screen to position the window. Often determining the distance from the upper-left corner of the screen is not as important as determining the size of the window. If UpperLeftX and UpperLeftY values are not set, the window will appear at a default location determined by Windows.
WindowWidth and WindowHeight can be set to the number of pixels wide and high desired for window. These must be set before the OPEN statement for the window. Once the size and placement of a window are set, the window may be opened with an OPEN statement. Here is an example:
[openStatus]
UpperLeftX = 32
UpperLeftY = 52
WindowWidth = 190
WindowHeight = 160
open "Status Window" for window as #stats
print "Screen width is ";DisplayWidth
print "Screen height is ";DisplayHeight
This will open a window 32 pixels from the left side of the screen and 52 pixels from the top of the screen, and with a width of 190 pixels, and a height of 160 pixels.
The screen resolution is contained in the special variables DisplayWidth and DisplayHeight. A screen resolution of 800x600 pixels returns values of 800 and 600 respectively for DisplayWidth and DisplayHeight. The sample code below prints the current screen resolution:
print "Screen width is ";DisplayWidth
print "Screen height is ";DisplayHeight
DisplayWidth and DisplayHeight can be used to compute values for WindowWidth and WindowHeight, as in these examples:
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight - 100
Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/