application class : AppNotice(class,string) method
Description
Assigns a handler to the "AppNotice" event.
Syntax
instance.AppNotice(class handleClass, string signature)
Arguments
Class | Name | Description |
class | handleClass | An instance with the handler as the member. |
string | signature | Signature of the handler. |
Return value
Class | Description |
switch | An instance to control handler execution. |
Sample code
Suppose you have the following class definition.
1: | class handle |
2: | open method void ANHandler(dictionary dic) |
3: | application sender = dic.Sender; |
4: | switch sw = dic.Switch; |
5: | string data = dic.Data; |
6: | endmethod |
7: | endclass |
Handler assignment is as follows.
1: | application aap; |
2: | handle h = new handle(); |
3: | switch sw = app.AppNotice(h,"ANHandler(dictionary)"); |
4: | sw.Start(); |
Notes
The "AppNotice" event is a notification between Rice scripts.
Cooker can run multiple Rice scripts at the same time. This event allows you to notify between scripts.
The handler for the "AppNotice" event must be an open method with one argument of the dictionary class.
In other words, if the method name of the handler is "handlerName", the definition of the handler is as follows.
open method void handlerName(dictionary dic)
...
endmethod
In this case, the signature of the handler specify by the second argument is "handlerName(dictionary)".
The dictionary passed to the handler has the following key/value pairs.
key | value - class | value - description |
Sender | application | The origin of the event. |
Switch | switch | The switch returned by the handler assignment. |
Data | string | Notification data. |
Links for reference
None.