switch class : IsAttached getter

Description

Returns a value that indicates whether the handler is attached to the event handling system.

Syntax

instance.IsAttached

Arguments

None

Return value

ClassDescription
boolWhether the handler is attached to the event handling system.

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 IsAttached getter 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.IsAttached; // "true"

5:

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

6:

att = sw.IsAttach; // false;

7:

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

8:

att = sw.IsAttach; // true;

Notes

The return value is as follows.

If the instance is acquired via the handler allocation method, true is returned because the handler is automatically attached to the event handling system.

Returns false after calling the Detach() method.

Returns true after calling the Attach() method.

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

Links for reference

None.

Copyright © Cooker All rights reserved.