2 Events

The event line is started with the keyword on.

Every rule may have a maximum of one event line which, however, can consist of several events for one object

The rule-triggering events can be divided into the following groups:

  • User events
  • Keyboard and help events
  • Internal events
  • System events
  • External events.

2.1 User Events

Events referring to a certain object, model or object class are called "user events". It is decisive for this kind of events that the user is the responsible cause for the event, i.e. the relevant event has been triggered as a result of user actions.

The syntax for this kind of event line is as follows:

on <object ID> <event> { , <event> }

This definition shows that a rule can be bound to only one object, but it can be bound to several events separated by a comma.

Object IDs are the identifiers for existing IDM objects such as OK_Button, TestWindow, etc.

Event types describe user-initiated events such as selected, moved, closed.

Example

on Pushbutton select

{

  Action;

}

The following event types are provided by the IDM.

Event Type

Description

activate

The indicated object has been activated. This event can be triggered for all objects whose active states can be clearly recognized by the user.

changed

Value of indicated variable or object attribute has been changed.

charinput

A character was input into an edittext. It can e.g. be checked now.

close

Close mechanism (e.g. closebox) of a window was used.

A sub-tree of a treeview has been closed.

cut The user has cut an object by Drag and Drop.

dbselect

The user has selected the object with a double click, i.e. has edited an object.

deactivate

The user has deactivated an object, e.g. if he selects a checkbox which has already been activated, so that it is now deactivated.

deiconify

The icon for a window has been re-opened.

deselect

An object has been deselected (by selecting another object or by ending the input in an edittext with the Return key).

deselect_enter

A text array input has been canceled by pressing the Return key.

extevent

An external event has occurred.

finish

End of a dialog or a module.

An application has been disconnected.

focus

The input focus has been set on the indicated object.

help

The user has asked for help for the current object. Calling the help function is carried out according to the requirements of the relevant window system (e.g. on Motif & Windows: F1 key, for Qt shortcut SHIFT+F1).

hscroll

The user has scrolled horizontally.

iconify

The iconifybox of a window has been activated -> window becomes an icon.

key

The user has pressed the accelerator given after the keyword key for the object for which this rule has been written (see also "Keyboard- and Help-events").

modified

The user has finished editing a text after actively changing it.

move

The user has moved the window.

A toolbar has been moved. With a docked toolbar the move event occurs only if the movement changes the attributes .dock_offset or .dock_line.

open

A menubox has been opened.

A sub-tree of a treeview has been opened.

paste

The user moved an object by Drag and Drop and has dropped it on another object.

resize

The size of a window has been changed.

With a splitbox the size of a split area has been changed.

scroll

The user has scrolled.

select

An object has been selected by user.

start

Start of a dialog or a module.

A connection to an application has been established.

vscroll

The user has scrolled vertically.

2.1.1 Objects and their User Events

All events which can be triggered by the user for an object are listed in the following chart.

Object

Event

Description

Application

extevent

 

 

finish

End of dialog (execution only if .local = true).

 

start

Beginning of dialog (execution only if .local = true).

Canvas

extevent

 

 

focus

 

 

help

 

Checkbox

extevent

 

 

focus

 

 

help

 

 

key

 

 

select, activate

Checkbox "on".

 

select, deactivate

Checkbox "off".

Dialog

deactivate

A timeout occurred.

 

extevent

 

 

finish

 

 

help

 

 

key

 

 

start

Dialog has been started.

Edittext

charinput

 

 

deselect

Edittext has been exited by a mouse click or by an unallowed key.

 

deselect_enter

Edittext has been exited by pressing the Return key.

 

extevent

 

 

focus

 

 

help

 

 

key

 

 

modified

Contents of edittext has been changed.

 

select, activate

Clicking on edittext.

Groupbox

extevent

 

 

help

 

 

key

 

 

scroll, hscroll

Scrolling has been carried out horizontally.

 

scroll, vscroll

Scrolling has been carried out vertically.

 

select

Clicking into groupbox without hitting anything else.

Import

none

 

Image

dbselect

 

 

focus

 

 

help

 

 

key

 

 

select

 

Listbox

dbselect

Double clicking on item.

 

extevent

 

 

focus

 

 

help

 

 

key

 

 

scroll, hscroll

Horizontal scrolling

 

scroll, vscroll

Vertical scrolling

 

scroll, activate

Item has been selected.

 

select, deactivate

Item has been deactivated (only in multiselection).

Menubox

extevent

 

Menuitem

extevent

 

 

help

 

 

select

Button as menuitem has been selected.

 

select, activate

Checkbox or radiobutton as menuitems were selected.

 

select, deactivate

Checkbox as menuitem has been deselected.

Menuseparator

extevent

 

Messagebox

extevent

 

Module

extevent

 

 

finish

Module is de-loaded.

 

start

Module has been loaded and started.

Notebook

extevent

 

 

focus

 

 

help

 

 

key

 

Notepage

activate

 

 

deactivate

 

 

extevent

 

 

focus

 

 

help

 

 

hscroll

 

 

key

 

 

scroll

 

 

select

 

 

vscroll

 

Poptext

activate

 

 

charinput

 

 

deselect

 

 

deselect_enter

 

 

extevent

 

 

focus

 

 

help

 

 

key

 

 

modified

 

 

select

User has selected a new item.

Pushbutton

extevent

 

 

focus

 

 

help

 

 

key

 

 

select

Clicking.

Radiobutton

activate

Clicking on a non-active radiobutton.

 

deactivate

 

 

extevent

 

 

focus

 

 

help

 

 

key

 

 

select

 

Rectangle

dbselect

 

 

extevent

 

 

focus

 

 

select

 

 

help

 

 

key

 

Scrollbar

extevent

 

 

focus

 

 

help

 

 

key

 

 

scroll

 

Setup

none

 

Statictext

extevent

 

 

focus

 

 

help

 

 

key

 

 

select

 

Statusbar

extevent

 

 

focus

 

 

help

 

 

key

 

 

paste

 

 

select

 

Spinbox

charinput

 

 

cut

 

 

extevent

 

 

focus

 

 

help

 

 

key

 

 

paste

 

 

select

 

 

scroll

 

Tablefield

activate

Object in tablefield has been activated.

 

charinput

The user has entered a valid character in the edittext attached to the tablefield. It can now e.g. be checked and the application can react on a key input in the tablefield.

 

deactivate

Object in tablefield has been deactivated.

 

dbselect

Double-click on object in tablefield.

 

extevent

 

 

focus

Focus has been changed in a tablefield or set on a tablefield.

 

help

Help event has been sent to the tablefield.

 

hscroll

Tablefield has been scrolled horizontally.

 

key

A key not needed by the tablefield has been pressed.

 

modified

Object in tablefield has been changed.

 

scroll

Tablefield has been scrolled.

 

select

Tablefield has been selected.

 

vscroll

Tablefield has been scrolled vertically.

Timer

select

 

Treeview

close

An item has been closed.

 

cut

 

 

dbselect

 

 

extevent

 

 

focus

 

 

help

 

 

key

 

 

open

An item has been opened.

 

paste

 

 

scroll, hscroll

Treeview has been scrolled horizontally.

 

scroll, vscroll

Treeview has been scrolled vertically.

 

select, activate

An item has been selected.

 

select, deactivate

Item has been deactivated (only in case of multiple selection).

Window

activate

 

 

close

 

 

deactivate

 

 

deiconify

 

 

extevent

 

 

help

 

 

iconify

 

 

key

 

 

move

 

 

resize

 

 

scroll + hscroll

Horizontal scrolling

 

scroll + vscroll

Vertical scrolling

 

select

Clicking into window without hitting anything else.

Note for IDM on Microsoft Windows

The event "dbselect" is always carried out without "activate" and "deactivate", because they have already been created in the former "select"-event.

Examples for Event Lines

2.1.2 Drag and Drop Events

In this chapter the events which are triggered by Drag&Drop operations are described. As with clipboard actions the relevant events are sent to the object. A Drag&Drop operation triggers a cut event at the source object and a paste event at the target object.

Note: The order of the events is arbitrary!

The Drag&Drop here described currently works on Microsoft Windows systems only.

2.1.2.1 Cut Event

On cutting the IDM does not automatically carry out a delete action, but reacts to the cut event. The attributes thisevent.type and thisevent.value are invalid and thus not used.

2.1.2.2 Paste Event

This event triggers a paste reaction.

thisevent.type contains a type_enum and shows the assumed format.

thisevent.value contains the data (DM data type).

When processing, note that .cut_pending = true, if the source object and target object are the same in a move operation (Cut + Paste).

2.1.2.3 Examples

The examples for these events are in directory …\examples\dragdrop.

Module with Standard Rules

The module dnd_defa.mod contains rules for the standard behavior of several objects.

Currently there are rules for Cut and Paste with the format type_text available for the objects edittext, listbox and tablefield.

Plain Rules

Special Rules

The return value of all rules indicates whether the processing has been executed successfully.

Dialog dnd_et.dlg

This dialog is a Drag&Drop example for an edittext. The rules of the module dnd_defa.mod are used.

Dialog dnd_lb.dlg

This dialog is a Drag&Drop example for a listbox. The rules of the module dnd_defa.mod are used.

Dialog dnd_tb.dlg

This dialog is a Drag&Drop example for a tablefield. The rules of the module dnd_defa.mod are used.

Dialog solitair.dlg

This stand-alone dialog illustrates how to use the Drag&Drop data type type_object.

2.1.2.4 Tips & Tricks for Drag & Drop and Clipboard

Cut rules and paste rules should always be able to operate independently, because of the following aspects:

As soon as "Cut" is allowed at an object, this operation may be triggered at any time. Before the rule "on Cut" is executed other rules might access the object. To avoid that important information is inadvertently falsified, the attribute .cut_pending is set to true.

This is why you should note the following when programming:

As long as .cut_pending = true no attributes can be changed at the object, i.e. rules, which might be called between the "Cut" triggering and the cut event (e.g. by on focus), cannot change the object per default.

Attention

In a Drag&Drop move operation on one and the same object, the paste event occurs before the cut event, i.e. with .cut_pending = true.

If, nevertheless, a rule is to reset attributes you may set .cut_pending := false. To inform the following cut rule you should set .cut_pending_changed := true.

For the processing of the format DM_Object in the paste rule you should check if the object really is available at that moment.

2.1.3 User Events with Special Inheritance

To process also key events in the ISA Dialog Manager Rule Language, these key events can be queried as follows:

on <object ID> key <accelerator>
<object ID>
Name of an object, a Model or a Default defined in the dialog.
<accelerator>
Name of an accelerator defined in the dialog.

This event is internally inherited in the IDM according to the following scheme, so that a rule has not to be defined for each object (if, e.g., the key F1 was pressed).

Figure 21-1: Inheritance at key/help-rules

This inheritance is interrupted as soon as one of these objects has defined a rule for this key.

Example

dialog Example
accelerator FK5
{
  0: F5;
}

window Window
{
  .xleft  10;
  .width  100;
  .ytop   10;
  .height 200;

  child pushbutton
  {
    .xleft 10;
    .ytop  10;
    .text  "pushbutton";
  }
}

on Example key FK5
{
  print "Key F5 was pressed";
}

The rule is executed as soon as F5 is pressed in this window.

The same mechanism of hierarchical inheritance is valid for the help event, i.e. only one rule is responsible for help. This rule is attached to the dialog.

2.2 Internal Events

Events referring to the change of an object attribute or of a variable are called internal events.

on <object ID><attribute name> changed

Please refer to the descriptions in the “Attribute Reference” for the attributes which can be used here.

The following is valid for variables:

on <variable name>.value changed

See Also

Attribute value

Examples

2.3 System Events

Events which refer to the entire IDM program system are called system events. These events are used to formulate rules for dialog or module starts and dialog or module ends.

The same applies to the object application.

Start Rule

on dialog start
  Event that indicates the start of the IDM program processing.
on module start
  Event that indicates the start of the module processing.
on application start
  Event that indicates the start of an application object processing.

Finish Rule

on dialog finish
  Event that indicates the end of the IDM program processing.
on module finish
  Event that indicates the end of the module processing.
on application finish
  Event that indicates the end of an application object processing.

The following system events are possible:

Event Type

Description

application start

Event which indicates the start of the processing of the "application" object.

application finish

Event which indicates the end of the processing of the "application" object.

dialog start

Event which indicates the start of the dialog processing.

dialog finish

Event which indicates the end of the dialog processing.

module start

Event which indicates the start of the dialog processing.

module finish

Event which indicates the end of the dialog processing.

Examples

Typically, the start rule contains statements for initializing data, the finish rule contains statements for a controlled exiting of the IDM (e.g. closing all windows).

The start rule should always be defined; at least one rule containing the keyword exit must be defined in addition.

Execution of the rule containing the keyword exit calls the finish rule.

2.4 External Events

External events are events that are to be treated equally to the dialog events in the ISA Dialog Manager as concerns their assignment and their processing. However, their source is not controlled by the IDM. One possible source of such events can e.g. be a signal handler which generates this event so that the dialog can respond to it.

An external event is a mixture of dialog event and parametrized rule.

As with parametrized rules, the number of parameters is limited to 16.

It has to be noted though, that only 14 parameters are usable when used from Rule Language. Therefore it is reasonable to define external events with a maximum of 14 parameters (see also built-in function sendevent()).

on <object ID> extevent <event ID> ([<data type> <parameter name> <type>])
anyvalue <event ID>
Indicates an identifier that is unique for the respective object and refers to the external event. For instance, a message resource may be used here.

External events are sent to an object and then passed to the object's Default until an object processes the event.

Example

on Object1 extevent 4711 (integer ErrCode, string ErrText);

on Object2 extevent EvSave (boolean Success, string Text);

The execution of a rule attached to an external event is registered by the application with the interface functions DM_QueueExtEvent or DM_SendEvent.Registered means that the rule is not executed immediately, but that the external event is queued and then processed according to the dialog event mechanisms.

See Also

C functions DM_QueueExtEvent and DM_SendEvent in manual “C Interface - Functions”