Events

This section contains the topics:

Event Names

Event names are used as arguments to the def primitive. Event names are also used when comparing events returned by the get_event or test_event built-in functions or when defining an event handler function. An event name is a string literal of a length of one or more. An event name string of a length one specifies an ASCII character. To keep the macro source compatible, some event names do not have to be enclosed in quotes as long as the _ (underscore) character is used instead of the - (dash) character. The following sections list the acceptable constants.

Keys

This section contains the following topics:

ASCII Characters

Acceptable ASCII characters are \0..\255. Backslash is used for non-displayable keys.

You may also quote displayable characters such as "a" or "4". The keys \1..\29 are also represented by the following keys:

  • C-A

  • C-B..C-Z

  • C-[,C-\\,C-]

  • C-^

  • C-_

The ASCII keys \129..\255 are the same key binding as \128.

Function Keys

Acceptable function keys are F1, F2, and F12.

Extended Keys

Acceptable extended keys are the following:

  • Backspace

  • Delete

  • Down

  • End

  • Enter

  • Escape

  • Home

  • Insert

  • Left

  • Pad_5

  • Pad_Minus

  • Pad_Plus

  • Pad_Slash

  • Pad_Star

  • PageDown

  • PageUp

  • Right

  • Tab

  • Up

Miscellaneous Keys

Acceptable miscellaneous keys are

  • C-A-Enter

  • C-A-Tab

  • C-A-Esc

  • C-A-Backspace

  • C-PrtScn

  • C-Ctrl

  • A-Alt

Key Name Examples

The following are examples of uses for key names in the Slick-CŪ language:

def "A-x"=safe_exit;  // Note that "A-a" is different than "A-A" which requires
                      // the Alt and Shift keys to be pressed.
def "A-?"=help;
def "C-X" "b"=list_buffers;
def \0 - \255= nothing;
ctlcombo1.on_change()
{
}
ctlcombo1."c-s-a"() // Define event handler for Ctrl+Shift+A
{
}
ctlcombo1."a"-"z", "A-"Z"()    // Define event handler for characters A-Z upper-
                               // and lowercase.
{
}
void p()
{
   for (;;) {
      key=get_event();
if (key:==name2event("ESC") break;
      if (key:==name2event("UP")) {
          ...
      } else if (key:==name2event("DOWN") ) {
          ...
      }
   }
}

Mouse Events

The following are acceptable mouse events.

  • lbutton_double_click

  • lbutton_down

  • lbutton_triple_click

  • lbutton_up

  • mbutton_double_click

  • mbutton_down

  • mbutton_triple_click

  • mbutton_up

  • rbutton_double_click

  • rbutton_down

  • rbutton_triple_click

  • rbutton_up

on Events

Below is a list of the on events. The acronyms "hsb" and "vsb" stand for horizontal and vertical scroll bar, respectively. ]

  • on_change

  • on_change2

  • on_close

  • on_create

  • on_create2

  • on_destroy

  • on_destroy2

  • on_drop_down

  • on_got_focus

  • on_hsb_bottom

  • on_hsb_line_down

  • on_hsb_line_up

  • on_hsb_page_down

  • on_hsb_page_up

  • on_hsb_thumb_pos

  • on_hsb_thumb_track

  • on_hsb_top

  • on_load

  • on_load_focus

  • on_resize

  • on_scroll

  • on_spin_down

  • on_spin_up

  • on_sscroll_lock

  • on_vsb_bottom

  • on_vsb_line_down

  • on_vsb_line_up

  • on_vsb_page_down

  • on_vsb_page_up

  • on_vsb_thumb_pos

  • on_vsb_thumb_track

  • on_vsb_top

Miscellaneous Events

on_select is an acceptable miscellaneous event.