SETCONTROLNOTIFY

Top  Previous  Next

Syntax

SETCONTROLNOTIFY win as WINDOW,id as INT,bTab as INT,bEnter as INT

Description

Turns control notification of enter and tab keys on or off.

Parameters

win - Window or dialog containing the control.

id - Control identifier.

bTab - TRUE to send @ENTABKEY notifications, FALSE otherwise.

bEnter- TRUE to send @ENENTERKEY notifications, FALSE otherwise.

Return value

None

Remarks

Designed for edit controls placed in a Window but will work with other controls as well.  @ENTABKEY and @ENENTERKEY are special notification codes sent in @NOTIFYCODE when enabled.  By default both are disabled for compatibility with older code and controls used in a dialog where the enter and TAB keys have a different meaning.

Example usage

WINDOW win
OPENWINDOW win,0,0,295,199,0,0,"Caption",&handler
CONTROL win,@EDIT,"Press Enter or TAB",83,39,124,27,0x50800000|@CTEDITAUTOH,5
SETFONT win,"Ariel",9,400,0,5
SETCONTROLNOTIFY(win,5,1,1)
SetFocus win,5
WAITUNTIL win=0
END
.
SUB handler
    SELECT @MESSAGE
        CASE @IDCONTROL
            IF @CONTROLID = 5
                SELECT @NOTIFYCODE
                    CASE @ENENTERKEY
                        MESSAGEBOX win,GetControlText(win,5),"Enter Pressed!"
                        SetFocus win,5
                    CASE @ENTABKEY
                        MESSAGEBOX win,"Tab key pressed","Info"
                        SetFocus win,5
                ENDSELECT
            ENDIF
        CASE @IDCREATE
            CENTERWINDOW win
        CASE @IDCLOSEWINDOW
            CLOSEWINDOW win
    ENDSELECT
RETURN
ENDSUB