browser class : LoadCompleted(class,string) method

Description

Assigns a handler to the "LoadCompleted" event.

Syntax

instance.LoadCompleted(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 LCHandler(dictionary dic)

3:

browser sender = dic.Sender;

4:

switch sw = dic.Switch;

5:

bool succ = dic.IsSuccess

6:

string wes = dic.WebErrorStatus;

7:

endmethod

8:

endclass

Handler assignment is as follows.

1:

browser b; // Main-browser

2:

handle h = new handle();

3:

switch sw = b.LoadCompleted(h,"LCHandler(dictionary)");

Notes

The "LoadCompleted" event is fired when the page loading has finished.


The handler for the "LoadCompleted" 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.
IsSuccessboolWhether the page loaded successfully.
WebErrorStatusstringThe reason for the page load failure.

WebErrorStatus returns a string like the one below.

CannotConnect

CertificateCommonNameIsIncorrect

CertificateExpired

CertificateIsInvalid

CertificateRevoked

ClientCertificateContainsErrors

ConnectionAborted

ConnectionReset

Disconnected

ErrorHttpInvalidServerResponse

HostNameNotResolved

OperationCanceled

RedirectFailed

ServerUnreachable

Timeout

UnexpectedError

Unknown

Returns "Unknown" if the load was successful.


The handler runs in its own thread.

Links for reference

None.

Copyright © Cooker All rights reserved.