Enable_Button_Events

Functions

void Disable_Button_Events (const char *keyboard, const char *button)
 Disables keyboard events. More...
 
void Enable_Button_Events (const char *keyboard, const char *button)
 Tells the system to start checking for keyboard button pushes. More...
 

Detailed Description

Function Documentation

◆ Disable_Button_Events()

void Disable_Button_Events ( const char *  keyboard,
const char *  button 
)

Disables keyboard events.

Parameters
keyboard- Commonly "?Keyboard". In general, a segment with an attached device driver that knows about a device with buttons on it.
button- The name of a button, or the names of several buttons (separated by commas.) See below for choices.

DETAILS

No additional details. See Enable_Button_Events()

◆ Enable_Button_Events()

void Enable_Button_Events ( const char *  keyboard,
const char *  button 
)

Tells the system to start checking for keyboard button pushes.

Parameters
keyboard- Commonly "?Keyboard". In general, a segment with an attached device driver that knows about a device with buttons on it.
button- The name of a button, or the names of several buttons (separated by commas.) See below for choices.

DETAILS

Button events are similar to "string" events, both gather input from a keyboard device. Button events occur instantly when the key is pressed. String events require a carriage return. Button events include a single key each. String events can include many. The system does not try to echo button input, and some special keys are available as buttons but not within strings.

Use button events to attach various keystrokes to each different immediate program action. Use string events when you need the user to type in the answer to a question.

In order for button input to occur, you have to name the device you're interested in hearing from and the keystrokes you're interested in hearing about. The easiest way to do this is to let one of the high-level "Get" routines do it for you. In the case of button events, the Get routine is Get_Button() . The main problems with Get_Button() are that unexpected events are thrown away, so you can't gracefully allow for input from a keyboard and a locator simultaneously. You have no control over which keyboard or which buttons trigger the event.

If you want to do better call Enable_Button_Events() directly to establish interest in a device and start it running. Then call Await_Event() to acquire new events. Finally call Show_Button() (or a related routine) to take a look at the events. When your program is done with the device, it can call Disable_Button_Events() to restore operations to their previous state.

Different levels of your program can simultaneously have the same type of event-enable in effect. The system keeps count of how many Enables do not have a matching Disable yet, and turns off the input only when this "enable count" reaches zero.

The choices for button include the following:

  • f0, f1, f2,...

    The "function" keys, if the specified device has them and the driver understands how to decode them.

  • kp0, kp1, kp2,...

    The "keypad" keys, if the specified device has them and the driver understands how to decode them.

  • misc

    The Insert, Delete, Home, End, PgUp, and PgDn buttons.

  • A, B, a, b, c, 0, 1,;,!, etc.

    Any single regular printing character, except a comma. ( Enable_Button_Events() doesn't accept any kind of range specification; you must list the characters one by one.)

  • comma

    The comma key, spelled out. (This is necessary because commas are used as separators in the button parameter.)

  • space

    The space key, with the name spelled out.

  • rubout

    The "rubout" or "delete" key.

  • control a, control b, , if the specified device has them and if the operating system allows HOOPS to read them. The interrupt key, the break key, the end-of-file key, and the flow-control control keys are typically not available for button events. On some systems the control keys may not be available at all.
  • left arrow, right arrow, up arrow, down arrow
    The "arrow" keys, if the specified device has them and the driver understands how to decode them.
  • control
    All the control keys the system knows about on the specified device.
  • function
    All the function keys the system knows about on the specified device.
  • arrow
    All the arrow keys the system knows about on the specified device.
  • keypad
    All the keypad keys the system knows about on the specified device.
  • letter
    All the letter keys—A to Z and a to z.
  • number
    All the number keys—0 to 9. This does not include the keypad number keys, if any, unless the keypad is running in a "numeric" mode.
  • printing
    All the printing keys the system knows about on the specified device.
  • anything
    Every key of any kind that the system knows about on the specified device.

More than one key can be specified—just separate the choices with commas within the quoted string. Single letters "A" through "Z" are case-sensitive; everything else is case-insensitive.

NOTES

If a specified key does not exist on the specified device a warning will be issued.

Button events and String events can be enabled on the same keyboard at the same time. If a key is a printing key and has a button attached, it will be included in both places.

The Enable or Disable does not take effect until the next call to Await_Event() or Check_For_Events() .

When a source of input is finally turned off, any pending events originating from it are discarded from the event queue.

RESTRICTIONS

Flagging enabled events causes confusion when a window with events enabled becomes invisible. The work around is to disable events before setting the visibility to off.

See also
Get_Button, Show_Button, Show_Button_Source, Enable_String_Events, Enable_Selection_Events, Enable_Location_Events, Enable_Wakeup_Events.