Xbasic

{ON_KEY}

IN THIS PAGE

Syntax

{ON_KEY= Key_Definition }

Arguments

Key_Definition

Character. The key click that you wish to respond to. Use the % character to indicate ALT keys, as in %5 for ALT-F5.

Description

Captures non-printable keystrokes and generates an Xdialog event.

Discussion

The {ON_KEY} command allows you to respond to specified keyboard keystrokes.

To find the definition of any particular key, open the Code Editor and click Code > More Genies > Insert Key Code.

Example

files = filefind.get("c:\*.*",0,"n")
ui_dlg_box("slider",<<%dlg%
Press F2 or Alt-F5;
{on_key=F2}
{on_key=%5}
{stretch=width,height}
[.20,10file^#files]{hslider}[.20,10contents]
%dlg%,<<%code%
if a_dlg_button = "F2" then
    a_dlg_button = ""
    ui_msg_box("","Why did you press F2?")
end if
if a_dlg_button = "%5" then
    a_dlg_button = ""
    ui_msg_box("","Why did you press Alt-F5?")
end if
%code%)
images/XD_On Key.gif

Limitations

Desktop applications only

See Also