ForegroundColor$

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 color of the text displayed in all controls.

Syntax

The variable is case sensitive.

  1. ForegroundColor$ = "named color"

Hints

Placing the statement. The ForegroundColor$ value must be set before a window is opened. If more than one ForegroundColor$ value is declared, the last value set will be valid for that window.
Colors. The color variables used for GUI controls can only use named colors.

Example

'set the foreground and background colors
nomainwin
BackgroundColor$ = "darkblue"
ForegroundColor$ = "lightgray"
statictext #dialog.static, "What is your name?", 10, 10, 100, 20
textbox #dialog.tbox, 10, 30, 100, 20
button #dialog.accept, "Accept", [gotIt], UL, 10, 55

    open "Name getter" for dialog as #dialog
    #dialog.tbox "Type your names in here."
    #dialog "trapclose [quit]"

    wait

[gotIt]
    #dialog.tbox "!contents? name$"

    notice "Hi "; name$
    wait
[quit]
    close #dialog
    end

Useful Procedures

' Place a useful function or sub using this keyword here