5.7 Events
An OLE server can send events to its client. For this purpose the resource message is available in the Dialog Manager and is defined at the dialog or module. At the control object the developer must specify which messages can be sent. The message object is available also in other object classes and corresponds to the former extevent event.
5.7.1 The message Resource
Events must be defined before using them, including their parameters. For this purpose the resource "message" is used, which is defined as follows:
<message> ::= {export} 'message' <label> { <messageSpec> };
<messageSpec> ::= '(' { <messageArg> [ ',' <messageArg> ] } ')'
<messageArg> ::= <datatype> [<label>]
Events to be exported must be defined at the control object, if these are to be passed on to the client. For this purpose the field attribute .message[] is available. This field can be used similarly to .content[], i.e. it can be accessed with setvalue /getvalue and the size can be queried with .count[].
The message resource can also be used independently of OLE control to define "named" events. The event can simply be sent to the control object with a sendevent(). Only those events defined in the field .message[] will be sent to the client, all other events will be processed in the dialog itself, just like external events.
Restrictions
The IDM OLE option supports the data types integer, string and boolean only. Other data types may be defined at the message resource, however it is not possible to generate a type library. Thus these data types cannot be used for data exchange via OLE.
Example
dialog D
message Msg(integer I, string S);
model control MC
{
.message[1] Msg;
:
pushbutton Pb
{
on select
{
sendevent(this.control,Msg,1998,"trigger action");
}
}
}
Notes and Restrictions
The client has to implement the event interface and link it to NotifySinks via the standard procedure. The client may either generate the corresponding sink dynamically via the type-library of the server, or statically use a sink for a known control. Sending unexpected, new events can produce a crash! This is why you should specify a new control UUID for new events.