WebBrowser control

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

Note

This control cannot be referenced in .NET Web Service or .NET Assembly components, 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

AddressChange

When a frame's address changes.

Clicked

(Unsupported by WebBrowser)

CertificateError

When failed to validate the server certificate.

Constructor

Immediately before the Open event occurs in the window.

Destructor

Immediately after the Close event occurs in the window.

DownloadingStart

Before a download begins.

DownloadingStateChanged

When the download status or progress information has been updated.

DragDrop

(Unsupported by WebBrowser)

DragEnter

(Unsupported by WebBrowser)

DragLeave

(Unsupported by WebBrowser)

DragWithin

(Unsupported by WebBrowser)

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.

LoseFocus

When the control loses focus (becomes inactive).

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.


Functions

You can use the global functions WebBrowserSet and WebBrowserGet to configure the path, user agent and proxy settings for 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.

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.

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.

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.


Properties of Microsoft Web Browser OLE vs. WebBrowser

Microsoft Web Browser OLE

WebBrowser

Visible

Visible

Height

Height

Width

Width

N/A

DefaultUrl

ContextMenu

PopupWindow

Border

BringToTop

Enabled

BorderStyle

TabOrder

Tag

LocationUrl

LocationName

AddressBar

Application

Busy

Container

Document

FullName

FullScreen

HWND

Left

MenuBar

Name

Offline

Parent

Path

ReadyState

RegisterAsBrowser

RegisterAsDropTarget

Resizable

Silent

StatusBar

StatusText

TheaterMode

ToolBar

Top

TopLevelContainer

Type

N/A


Events of Microsoft Web Browser OLE vs. WebBrowser

Microsoft Web Browser OLE

WebBrowser

Constructor

Constructor

NavigateError

NavigationError

BeforeNavigate2

NavigationStart

StatustextChange (returns the proxy first, and then the URL etc.)

NavigationStateChanged (returns cangoback and cangoforward)

TitleChange

TitleTextChanged

ProgressChange (returns the amount of the completed items)

NavigationProgressIndex (returns the percentage of completion)

DownloadComplete

DownloadingStateChanged

N/A

AddressChange

ResourceRedirect

PdfPrintFinished

DownloadingStart

DownloadBegin

BeforeScriptExecute

ClientToHostWindow

CommandStateChange

DocumentComplete

FileDownload

NavigateComplete2

NewProcess

NewWindow2

NewWindow3

OnFullScreen

OnMenuBar

OnQuit

OnstatusBar

OnTheaterMode

OnToolBar

OnVisible

PrintTemplateInstantiation

PrintTemplateTeardown

PrivacyImpactedStateChange

PropertyChange

RedirectXDomainBlocked

SetPhishingFilterStatus

SetSecureLockIcon

ThirdPartyUrlBlocked

UpdatePageStatus

WebWorkerFinsihed

WebWorkerStarted

WindowClosing

WindowSetHeight

WindowSetResizable

WindowSetLeft

WindowSetTop

WindowSetWidth

WindowStateChanged

N/A


Functions of Microsoft Web Browser OLE vs. WebBrowser

Microsoft Web Browser OLE

WebBrowser

Navigate

Navigate

GoBack

GoBack

GoForward

GoForward

Refresh

Refresh

(in the right-click popup menu)

PrintAsPDF

ProgressChange

(via NavigationProgressIndex event)

N/A

Zoom

GetSource

PauseDownload

ResumeDownload

CancelDownload

StopNavigation

AddressBar

BeforeNavigate

ClientToWindow

CommandStateChange

DownloadBegin

DownloadComplete

ExecWB

FrameBeforeNavigate

FrameNavigateComplete

FrameNewWindow

FullScreen

GetProperty

GoHome

GoSearch

Height

Left

MenuBar

NavigateComplete

NewWindow

Offline

PropertyChange

PutProperty

Int QueryStatusWB

Quit

RegisterAsBrowser

RegisterAsDropTarget

Resizable

Silent

ShowBrowserBar

StatusBar

StatusText

StatusTextChange

Stop

TheaterMode

TitleChange

ToolBar

Top

Visible

Width

WindowActivate

WindowMove

WindowResize

N/A