Home News DOC Class DL Others Rice
Class  >  browser  >  LoadStart(class,string)
browser class : LoadStart(class,string) method

Description

Assigns a handler to the "LoadStart" event.

Syntax

instance.LoadStart(class handleClass, string signature)

Arguments

ClassNameDescription
classhandleClassAn instance with the handler as the member.
stringsignatureSignature of the handler.

Return value

ClassDescription
switchAn instance to control handler execution.

Sample code

Suppose you have the following class definition.

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

Handler assignment is as follows.

1:

window w;

2:

browser b = w.CurrentBrowser;

3:

handle h = new handle();

4:

switch sw = b.LoadStart(h,"LSHandler(dictionary)");

Notes

The handler for the "LoadStart" event must be an open method with one argument of the dictionary class.

In other words, if the method name of the handler is "handlerName", the definition of the handler is as follows.


open method void handlerName(dictionary dic)

...

endmethod


In this case, the signature of the handler specify by the second argument is "handlerName(dictionary)".

The dictionary passed to the handler has the following key/value pairs.

keyvalue - classvalue - description
SenderbrowserThe origin of the event.
SwitchswitchThe switch returned by the handler assignment.
IsRedirectboolWhether the load was caused by a page redirect.
IsUserGestureboolWhether the load was caused by user action.
UrlstringURL.
CancelboolWhether to cancel the event.

The handler runs in the UI thread.

Links for reference

None.

Copyright © Rice All rights reserved.