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


Renders a control inactive and grayed out. The control is not usable until an ENABLE command is issued.


  1. #handle.ckbx "disable"
For controls that can accept new text strings include an exclamation mark (!):
  1. #handle.btn "!disable"
See the individual Building Blocks pages for control specific information.


A graphic box control that has been disabled can no longer capture mouse and keyboard events.
In contrary to a help file, a text editor control that has been disabled does not get grayed out.



msg$ = "Well, stranger. Seems like you have wandered into the wrong room. ";_
"You may think you have completed your quest, but there's one more thing to do. ";_
"Before you can Exit this room, you must agree to leave all the gold you have collected! ";_
"You will be able to see the way out once you have complied with my demand. ";_
chr$(13); chr$(13);_
"Until you do, and until you affix your mark to the box below, you will not find the doorway out."
ht$ = "Happy trails, stranger."

    textbox #main.txtbx, 40, 140, 210, 30
    statictext #main.stxt,  "", 10, 10, 280, 120
    button #main.btn, "", [quit], UL, 110, 200, 60, 100
    statictext #main.ht, "", 40, 175, 150, 20

    open "Gotcha" for window as #main
    #main "trapclose [quit]"
    #main.stxt msg$
    #main.ht "!disable"
    #main.txtbx "!setfocus"

    ' Disable the exit button
    #main.btn "!disable"

    ' Loop until user makes his mark
    #main.txtbx "!contents? name$"
    if len(name$) > 1 then
        goto [nameEntered]
    end if
    timer 100, [done]
    timer 0
    goto [loop]

    ' Enable the exit button
    #main.btn "Exit Door"
    #main.btn "!enable"
    ' Enable statictext and farewell
    #main.ht ht$
    #main.ht "!enable"

    close #main

Useful Procedures

' Place a useful function using this keyword here