Home News DOC Class DL Others Rice
Class  >  switch  >  Handler(anyclass)
switch class : Handler(anyclass) setter

Description

Sets an instance of an user-defined class that have the handler method.

Syntax

instance.Handler = value

Arguments

ClassDescription
user-defined classAn instance of an user-defined class.

Return value

None

Sample code

Suppose you have the following class definition.

1:

class handleA

2:

open method void LCHandler(dictionary dic)

3:

... // event handler code.

4:

endmethod

5:

endclass

6:

class handleB

7:

open method void LCHandler(dictionary dic)

8:

... // event handler code.

9:

endmethod

10:

endclass

Usage of the Handler setter is as follows.

1:

browser b = new browser();

2:

handleA ha = new handleA();

3:

handleB hb = new handleB();

4:

switch sw = b.LoadCompleted(ha,"LCHandler(dictionary)"); // It sets the instance of the handleA class.

5:

sw.Handler = hb; // It changes the instance to the handleB class.

In the above code, Handler instances are different class, but these have the method with same signature, so it works fine.

Notes

None

Links for reference

None

Copyright © Rice All rights reserved.