window class : Closing(class,string) method
Description
Assigns a handler to the "Closing" event.
Syntax
instance.Closing(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 CHandler(dictionary dic) |
3: | switch sw = dic.Switch; |
4: | endmethod |
5: | endclass |
Handler assignment is as follows.
1: | window w = new window(); |
2: | handle h = new handle(); |
3: | switch sw = w.Closing(h,"CHandler(dictionary)"); |
Notes
The "Closing" event occurs just before the window is closed.
You can cancel the event by assigning true to the 'Cancel' key of the handler argument. If you cancel, the window will not close.
The handler for the "Closing" 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 | window | The origin of the event. |
Switch | switch | The switch returned by the handler assignment. |
Cancel | bool | Whether to cancel the event. |
The handler runs in the UI thread.
Links for reference
None.