UpperLeftX

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 horizontal distance in pixels of the window from the upper left corner of the screen. If no value is set, Windows will use a default position.
See also DisplayWidth and WindowWidth.

Syntax

The variable is case sensitive.
  1. UpperLeftX = value (using a pixel amount)
  2. UpperLeftX = leftOffset (using a variable)
  3. UpperLeftX = int((DisplayWidth-WindowWidth)/2) (centered on screen)

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 to set the window's position.
Using a Variable. You must declare the variable's value before using it in the position 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