WindowHeight

From Liberty BASIC Family
Jump to navigation Jump to search
Supported in Just BASIC Supported in Liberty BASIC Not supported in Liberty BASIC 5 Not supported in Run BASIC

Description

Sets the height in pixels of the window to be opened. If no value is set, Windows will use a default size.
See also UpperLeftY and DisplayHeight.

Syntax

The variable is case sensitive.
WindowHeight = 100                      ' using an amount in pixels
WindowHeight = int(DisplayHeight / 2)   ' as a proportion of the screen size
WindowHeight = mainWindowHeight         ' as a 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 DisplayHeight

This special variable contains the height of the display screen in pixels and is available to be used in the WindowHeight 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