WindowWidth
Jump to navigation
Jump to search
Description
- Sets the width in pixels of the window to be opened. If no value is set, Windows will use a default size.
- See also DisplayWidth and UpperLeftX.
Syntax
- The variable is case sensitive.
WindowWidth = 100 ' using a literal value in pixels WindowWidth = int(DisplayWidth / 2) ' as a proportion of the screen size WindowWidth = mainWindowWidth ' as the value of a variable in pixels
Hints
- Statements.
- Statements for sizing and positioning a window must be made before the window is OPENed.
- Using DisplayWidth
- This special variable contains the width of the display screen in pixels and is available to be used in the WindowWidth expression for sizing.
- Using a Variable.
- You must declare the variable's value before using it in the sizing expression.
Example
'This example shows different ways to set your window size and position.
nomainwin
[openStatus]
statusWindowHeight = int(DisplayHeight/3)
WindowWidth = 600
WindowHeight = statusWindowHeight
UpperLeftX = int((DisplayWidth-WindowWidth)/2)
UpperLeftY = 100
statictext #stats.w "", 50, 75, 400, 25
statictext #stats.h "", 50, 125, 400, 25
open "Status Window" for window as #stats
#stats "trapclose [quit]"
#stats.w "Screen width is ";DisplayWidth
#stats.h "Screen height is ";DisplayHeight
wait
[quit]
close #stats
end
Useful Procedures
' Place a useful function or sub using this keyword here