switch class : Attach() method

Description

Attaches the handler to the event handling system.

Syntax

instance.Attach()

Arguments

None

Return value

None

Sample code

Suppose you have the following class definition.

1:

class handle

2:

open method void LCHandler(dictionary dic)

3:

... // event handler code.

4:

endmethod

5:

endclass

Usage of the Attach() method is as follows.

1:

browser b = new browser();

2:

handle h = new handle();

3:

switch sw = b.LoadCompleted(h,"LCHandler(dictionary)"); // The handler is automatically attached.

4:

bool att = sw.IsAttach; // true;

5:

sw.Detach(); // Detach the handler.

6:

att = sw.IsAttach; // false;

7:

sw.Attach(); // Re-attach the handler.

Notes

If you call the handler assignment method as in the sample code, the handler is automatically attached to the event handling system.

If already attached, the method call is ignored.

The implementation of event handling has been changed in Cooker ver 3.0.3. This method was added as a result of that change.

Links for reference

None

Copyright © Cooker All rights reserved.