SETFOCUS

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

This causes Windows to give input focus to this control. This means that, if some other control in the same window was highlighted and active, this control now becomes the highlighted and active control, receiving mouse and keyboard input.

Syntax

  1. controlType #handle.ext "setfocus"
  2. controlType #handle.ext "!setfocus"

Hints

Controls with captions, or that can receive text input, have an exclamation point (!) preceding the "setfocus" command. The exclamation point distinguishes a command from the text or caption.

Example

    nomainwin
    statictext #1.st1 "This example shows the use of setfocus.", 10, 10, 200, 25
    button #1.btn1 "Press Enter key", [quit], UL, 80, 150

    open "Setfocus Demo" for window as #1
    #1 "trapclose [quit]"

    #1.btn1 "!setfocus"

    wait

[quit]
    close #1
    end

Useful Procedures

' Place a useful function or sub using this keyword here