switch クラス : Handler(anyclass) セッタ
説明
イベントを処理するユーザー定義クラスのインスタンスを設定します。
構文
instance.Handler = value
代入値
| クラス | 説明 |
| any class | イベントを処理するユーザー定義クラスのインスタンス。 |
返り値
無し。
サンプルコード
次のクラス定義があるとします。
| 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 |
Handler セッターの使い方は次のとおりです。
| 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. |
上記のコードでは、Handlerインスタンスは異なるクラスですが、これらは同じシグネチャを持つメソッドを持っているため、正常に機能します。
注意
無し。
参照リンク
無し。


