Event tables are for creating event-driven dialog boxes and inheritance. The event table definition code is automatically inserted by the dialog editor. To begin working with event tables, see Creating Dialog Boxes. To attach an event table to a form (dialog box outer window) or form control, define an event table with the same name (p_name property) as the form. Dot the form name with the control name if you want to specify inheritance for an event table that is attached to a control.
Example:
defeventtab form_name[.control_name] [_inherit [etab_name]];
Using the _inherit primitive, you can link one event table to another. This makes it possible to perform Clipboard Inheritance® (see Clipboard Inheritance®). If no name follows the _inherit keyword, the inheritance is unlinked. To add event handlers using the def primitive or by defining an event handler function, use the following syntax:
[ReturnType] ctl_name.event [- event] [, event [- event]] ...( [ArgDecl1, ArgDecl2,...])
{
statements
}
If ctl_name is the same name as the last event table form name (name before dot), the event handler is attached to an event table named form_name. Otherwise, the event handler is attached to an event table named form_name.ctl_name.
The word event in the previous code can be any valid event name. Some event names do not need to be enclosed in quotes. It is a best practice to always enclose the event names in quotes.
The syntax for ArgDecls is the same as is the syntax for declaring a variable except that the static keyword may not be used. An ampersand (&) before the id declares a call by references parameter. Call by reference array and hash table parameters require parentheses around the ampersand and id.
The following is an example of a form with a text box and OK button:
#include "slick.sh"
// Define an event table for the dialog box window.
defeventtab form1;
// Since this is the first event handler defined for this control
// and the name of this control does not match the last defined event, the
// table, the Slick-C translator automatically defines the event table
// form1.ctlcommand1 and defines the lbutton_up event handler within
// this new event table.
void ctlcommand1.lbutton_up()
{
// Set the p_text property of the text box control.
ctltext1.p_text="Hello World";
}When the above code is loaded with the load command (Macro → Load Module), the editor attaches the form1.ctlcommand1 event table to a control named ctlcommand1 on form1. A form1 event table is not created because an event handler for this event table was defined. When you save the configuration, event tables that are not used are deleted.