DlgFocus, DlgFocus$()

Syntax

DlgFocus Identifier[$]

DlgFocus$()

Remarks

The DlgFocus statement is used within a dialog function to set the focus on the dialog box control identified by Identifier[$] while the dialog box is displayed. When a dialog box control has the focus, it is active and responds to keyboard input. For example, if a text box has the focus, any text you type appears in that text box.

The DlgFocus$() function returns the string identifier for the dialog box control that currently has the focus.

For information about using a dialog function, see Chapter 5, "Working with Custom Dialog Boxes," in Part 1, "Learning WordBasic."

Example

This example sets the focus on the control "MyControl1" when the dialog box is initially displayed. (The main subroutine that contains the dialog box definition is not shown.)


Function MyDlgFunction(identifier$, action, suppvalue)
Select Case action
    Case 1                    'The dialog box is displayed
        DlgFocus "MyControl1"
    Case 2                    'The user selects a control
        'Statements that perform actions based
        'on which control is selected go here
    Case 3                    'Text change (not applicable)
    Case Else
End Select
End Function

See Also

DlgEnable, DlgVisible