browser クラス : LoadStart(class,string) メソッド
説明
ハンドラを"LoadStart"イベントに割り当てます。
構文
instance.LoadStart(class handleClass, string signature)
引数
| クラス | 名前 | 説明 |
| class | handleClass | ハンドラをメンバとして持つインスタンス。 |
| string | signature | ハンドラのシグネチャ。 |
返り値
| クラス | 説明 |
| switch | ハンドラの実行を制御するインスタンス。 |
サンプルコード
次のクラス定義があるとします。
| 1: | class handle |
| 2: | open method void LSHandler(dictionary dic) |
| 3: | browser sender = dic.Sender; |
| 4: | switch sw = dic.Switch; |
| 5: | bool ir = dic.IsRedirect |
| 6: | bool iug = dic.IsUserGesture; |
| 7: | string url = dic.Url; |
| 8: | bool cancel = dic.Cancel; |
| 9: | dic.Cancel = true; // It cancels the page loading. |
| 10: | endmethod |
| 11: | endclass |
ハンドラの割り当ては次のとおりです。
| 1: | browser b; // Main-browser |
| 2: | handle h = new handle(); |
| 3: | switch sw = b.LoadStart(h,"LSHandler(dictionary)"); |
注意
"LoadStart"イベントはページのロードが開始された時に発生します。
ハンドラ引数の Cancel キーに true を代入することでイベントをキャンセル出来ます。キャンセルするとページのロードは起こりません。
"LoadStart"イベントのハンドラは、dictionaryクラスの引数を一つ持つopenメソッドでなければなりません。
つまり、ハンドラのメソッド名が "handlerName"の場合、ハンドラの定義は次のようになります。
open method void handlerName(dictionary dic)
...
endmethod
この場合、第2引数で指定されるハンドラのシグネチャは "handlerName(dictionary)"です。
イベント発生時にハンドラに渡される dictionary は以下の key と value のペアを持ちます。
| key | value(クラス) | value(説明) |
| Sender | browser | イベントの発生元。 |
| Switch | switch | ハンドラの割り当てで返される switch と同じインスタンス。 |
| IsRedirect | bool | ロードがページのリダイレクトにより起こったかどうかを示す値。 |
| IsUserGesture | bool | ロードがユーザーの動作により起こったかどうかを示す値。 |
| Url | string | URL。 |
| Cancel | bool | イベントをキャンセルするかどうかを示す値。 |
ハンドラはブラウザの実行スレッド(UIスレッド)で実行されます。
参照リンク
無し。


