Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

RegisterEvent – PB Docs 2022 – PowerBuilder Library

RegisterEvent – PB Docs 2022

RegisterEvent

PowerScript function

Description

Registers the PowerBuilder user event so they can be triggered in
JavaScript. For how to define and trigger the PowerBuilder user event,
refer to Triggering PowerBuilder events in
JavaScript
.

Applies to

WebBrowser
control

Syntax

Argument

Description

controlname

The name of the WebBrowser control.

eventName

The name of the user-defined event to be
registered.

Return value

Integer.

Returns 1 if the function succeeds and a negative value if an error occurs.
If any argument’s value is null, the method returns null.

Usage

The initialization of the WebBrowser control is run as a separate
process from the PowerBuilder application. Therefore, if the WebBrowser
control is being initialized while you register the event in PowerBuilder,
the registration will fail. To avoid such issue, it is recommended that
you trigger the NavigateStart event
first. If NavigateStart can be triggered
successfully, it indicates that WebBrowser is completely initialized. For
example, you can add the following code to the NavigateStart event:

Example 1

The following example defines a PowerBuilder user event which is
then triggered in JavaScript in wb_1, and the result of the JavaScript
which is returned in a JSON string is parsed by the JSONParser
object.

Note that this user event should not call any other WebBrowser
function, otherwise the application may get stuck.

Example 2

The following example registers a PowerBuilder user event in the
WebBrowser NavigationProgressIndex event,
and then triggers the user event in JavaScript in an HTML file.

Step 1: Defines the user event: ue_getstring in
the WebBrowser control.

Step 2: Registers the user event: ue_getstring
in the WebBrowser NavigationProgressIndex
event.

Note that the NavigationProgressIndex event will be triggered
multiple times when the HTML page is being loaded. It is recommended to
execute the next script after the NavigationProgressIndex event receives the value of
100 (which means the page is 100% loaded).

Step 3: Triggers the user event in JavaScript in the HTML page:
page.html.

Step 4: Loads the HTML page in the WebBrowser control.

Example 3

The following example defines a user event which is then triggered
in JavaScript in wb_1:

See also

CancelDownload

EvaluateJavascriptAsync

EvaluateJavascriptSync

GetSource

GoBack

GoForward

Navigate

PrintAsPDF

PauseDownload

ResumeDownload

Refresh

StopNavigation

UnregisterEvent

Zoom


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x