switch class : Signature(string) setter

Description

Sets the signature of the handler.

Syntax

instance.Signature = value;

Arguments

ClassDescription
stringThe signature of the handler.

Return value

None

Sample code

Suppose you have the following class definition.

1:

class handle

2:

open method void LCHandlerA(dictionary dic)

3:

... // event handler code.

4:

endmethod

5:

open method void LCHandlerB(dictionary dic)

6:

... // event handler code.

7:

endmethod

8:

endclass

Usage of the Signature setter is as follows.

1:

browser b = new browser();

2:

handle h = new handle();

3:

switch sw = b.LoadCompleted(h,"LCHandlerA(dictionary)"); // It sets the signature of the LCHandlerA(dictionary) method.

4:

sw.Signature = "LCHandlerB(dictionary)"; // It changes the signature to the LCHandlerB(dictionary) method.

The switch searches a handler with the Signature.

When the event occurs, the switch looks for the Signature - LCHandlerB(dictionary) - in the Handler - an instance of the handle class - and calls it as a handler.

Notes

You should set an open method has an argument of dictionary class as Signature.

If you set an closed method as Signature, an exception will occur on call.


The signature is the information for the switch to call the handler. It is a string that concatenates the handler method name and arguments.

The handler must be an open method with one argument of the dictionary class. If the method name of the handler is "handlerName", the definition of the handler is as follows.


"handlerName(dictionary)"

Links for reference

None

Copyright © Cooker All rights reserved.