WebBrowser control

The WebBrowser control can be used to create a Web browser that can communicate between a Web page and the PowerBuilder application client. For more about using the WebBrowser control, see the section called “Working with WebBrowser” in Users Guide.

Note

This object cannot be referenced in the .NET Assembly component, otherwise the component will fail to be deployed.

Properties

WebBrowser property

Datatype

Description

AccessibleDescription

String

A description of the control and/or its purpose for use by accessibility tools such as readers for visually impaired users.

AccessibleName

String

A label that briefly describes the control, such as the text in a button or the name of a menu item.

AccessibleRole

AccessibleRole (enumerated)

Describes what kind of user interface element the control is.

Border

Boolean

Specifies whether the control has a border. Values are:

  • TRUE -- Has a border.

  • FALSE -- Does not have a border.

BorderStyle

BorderStyle (enumerated)

Specifies the style of the border of the control. Values are:

StyleBox!

StyleLowered!

StyleRaised!

StyleShadowBox!

BringToTop

Boolean

Specifies whether PowerBuilder moves the control to the top of the front-to-back order. Values are:

  • TRUE -- Moves to the top.

  • FALSE -- Does not move to the top.

ClassDefinition

PowerObject

An object of type PowerObject containing information about the class definition of the control.

ContextMenu

Boolean

Specifies whether users can use the right mouse button menu on the web page.

When this property is changed at runtime, the Web page will need to be refreshed or navigated again for the property to take effect.

DefaultUrl

String

The URL address that the control opens by default.

This property can only be set in the painter and cannot be changed at runtime.

DragAuto

Boolean

Specifies whether PowerBuilder puts the control automatically into Drag mode. Values are:

TRUE -- When the control is clicked, the control is automatically in Drag mode.

FALSE -- When the control is clicked, the control is not automatically in Drag mode. You have to manually put the control into Drag mode by using the Drag function.

DragIcon

String

Specifies the name of the stock icon or the file containing the icon you want to display when the user drags the control (the ICO file). The default icon is a box the size of the control.

When the user drags the control, the icon displays when the control is over an area in which the control can be dropped (a valid drop area). When the control is over an area that is not a valid drop area, the No-Drop icon displays.

Enabled

Boolean

Specifies whether the control is enabled (can send and receive messages). Values are:

  • TRUE -- Can send/receive messages.

  • FALSE -- Cannot send/receive messages.

Height

Integer

Specifies the height of the control, in PowerBuilder units.

PopupWindow

Boolean

Specifies whether the new page is opened in a new popup window (similar to "Open in new tab" in the other Web browsers).

When this property is changed at runtime, the Web page will need to be refreshed or navigated again for the property to take effect.

TabOrder

Integer

This property is currently unsupported for the WebBrowser control. The WebBrowser control cannot receive focus when the user tabs among controls within a window.

Tag

String

Specifies the tag value assigned to the control.

Transparency

Integer

Specifies the transparency of the control. Value is a percentage in the range 0 (opaque) to 100 (completely transparent).

Visible

Boolean

Specifies whether the control is visible. Values are:

  • TRUE -- Control is visible.

  • FALSE -- Control is not visible.

Width

Integer

Specifies the width of the control, in PowerBuilder units.

X

Integer

Specifies the X position (the distance from the left edge of the window) of the control, in PowerBuilder units.

Y

Integer

Specifies the Y position (the distance from the top of the window) of the control, in PowerBuilder units.


Events

WebBrowser event

Occurs

AcceleratorKeyPressed

When an accelerator key or key combination is pressed or released while the WebBrowser control gets the focus.

AddressChange

When a browser address changes.

Clicked

(Unsupported by WebBrowser)

CertificateError

When failed to validate the server certificate.

ContentLoading

When the WebBrowser starts loading the content of a new page.

Constructor

Immediately before the Open event occurs in the window.

Destructor

Immediately after the Close event occurs in the window.

DOMContentLoaded

When the WebBrowser control has completed parsing the DOM content during the page loading process.

DownloadingOperationStateChanged

When the download operation state is changed.

DownloadingStart

Before a download begins.

DownloadingStateChanged

When the download status or progress information is changed.

DragDrop

(Unsupported by WebBrowser)

DragEnter

(Unsupported by WebBrowser)

DragLeave

(Unsupported by WebBrowser)

DragWithin

(Unsupported by WebBrowser)

EstimatedEndTimeChanged

When the estimated end time is changed.

EvaluateJavascriptFinished

After the EvaluateJavascriptAsync function is executed.

GetFocus

Just before the control receives focus (before it is selected and becomes active).

Help

When the user presses the F1 key or drags the context help button (question mark) from the title bar to a menu item or control.

HistoryChanged

When the navigation history is changed.

IsDefaultDownloadDialogStateChanged

When the default download dialog state is changed.

LoseFocus

Occurs just before a control loses focus (before it becomes inactive).

NavigationCompleted

When the navigation is completed.

NavigationError

When the navigation fails or is cancelled.

NavigationProgressIndex

When the overall page loading progress has changed.

NavigationStart

After a navigation has been committed and before the browser begins loading contents in the frame.

NavigationStateChanged

When the navigation state changes.

Other

When a Windows message occurs that is not a PowerBuilder event.

PdfPrintFinished

When the process of printing Web page as PDF is completed.

RButtonDown

(Unsupported by WebBrowser)

ResourceRedirect

When a resource load is redirected.

TitleTextChanged

When the page title changes.

WebMessageReceived

When a message sent by JavaScript is received.


Functions

You can use the global functions WebBrowserSet and WebBrowserGet to configure the settings of the WebBrowser control.

WebBrowser function

Datatype returned

Description

CancelDownload

Integer

Cancels the downloading progress of files.

ClassName

String

Returns the name assigned to the control.

CloseDefaultDownloadDialog

Integer

Closes the default download dialog.

Drag

Integer

Starts or ends the dragging of the object.

EvaluateJavascriptAsync

Integer

Executes JavaScript asynchronously. This function triggers the EvaluateJavascriptFinished event.

EvaluateJavascriptSync

Integer

Executes JavaScript synchronously.

GetContextService

Integer

Creates a reference to a context-specific instance of the specified service.

GetParent

PowerObject

Returns a reference to the name of the parent object.

GetSource

String

Gets the HTML source code for the current page's main frame.

GoBack

Integer

Goes back from the current page to the last page browsed.

GoForward

Integer

Jumps from the current page to the next page.

Hide

Integer

Makes the object invisible.

Move

Integer

Places the object in a new location specified by the X and Y arguments.

Navigate

Integer

Browses the specified page.

NavigateToString

Integer

Loads a page from the specified HTML source code.

OpenDefaultDownloadDialog

Integer

Opens the default download dialog.

PauseDownload

Integer

Suspends the downloading progress of files.

PointerX

Integer

Returns the distance of the pointer from the left edge of the control.

PointerY

Integer

Returns the distance of the pointer from the top of the control.

PostEvent

Boolean

Adds an event to the end of the message queue for the control.

PostJsonWebMessage

Integer

Sends the web message in the JSON format to the top-level document in WebBrowser asynchronously.

PostStringWebMessage

Integer

Sends the web message in a simple string to the top-level document in WebBrowser asynchronously.

Print

Integer

Prints the control.

PrintAsPDF

Integer

Prints the current web page as PDF.

Refresh

Integer

Refreshes the current page.

RegisterEvent

Integer

Registers the user defined event so that it can be triggered in JavaScript.

User events can be defined with only one string-type parameter and string-type return value.

Resize

Integer

Changes the size of the control.

ResumeDownload

Integer

Resumes the downloading progress of files that were suspended.

SetFocus

Integer

Sets focus to the control.

SetPosition

Integer

Specifies the position of the control in the front-to-back order of the window.

SetRedraw

Integer

Controls automatic redrawing of the control after each change in its properties.

Show

Integer

Makes the control visible.

StopNavigation

Integer

Stops navigating the source.

TriggerEvent

Integer

Triggers a specified event in the control and executes the script for the event.

TypeOf

Object

Returns the type of the control.

UnregisterEvent

Integer

Unregisters the user defined event that is registered using the RegisterEvent function.

Zoom

Integer

Scales the current view with the specified zoom ratio.