Tabular IQ

WebBrowser Class

Class Index By Category

Overview

The WebBrowser class represents a web browser control.

Base Class

FormControl

Constructor

WebBrowser(x_pos : Integer, y_pos : Integer, width : Integer, height : Integer)

Arguments

x_pos
The x position of the control.
y_pos
The y position of the control.
width
The width of the control.
height
The height of the control.

Events

WebBrowser.navigated
Fired when the web control has been navigated to a new location.

Methods

WebBrowser.canCopyImageContents
Deprecated; wxWebView has no equivalent. Always returns false.
WebBrowser.canCopyImageLocation
Deprecated; wxWebView has no equivalent. Always returns false.
WebBrowser.canCopyLinkLocation
Deprecated; wxWebView has no equivalent. Always returns false.
WebBrowser.canCopySelection
Indicates if a there's a selection in the web control that can be copied.
WebBrowser.canCutSelection
Indicates if a there's a selection in the web control that can be cut.
WebBrowser.canPaste
Indicates in the current contents of the system clipboard can be pasted.
WebBrowser.copyImageContents
Deprecated; wxWebView has no equivalent. No-op.
WebBrowser.copyImageLocation
Deprecated; wxWebView has no equivalent. No-op.
WebBrowser.copyLinkLocation
Deprecated; wxWebView has no equivalent. No-op.
WebBrowser.copySelection
Copies the current selection to the system clipboard.
WebBrowser.cutSelection
Cuts the current selection.
WebBrowser.getDOMDocument
Deprecated. The wxWebView-based control does not expose a DOM Core API; this method always returns null.
WebBrowser.getLocation
Gets the current URI for the web control.
WebBrowser.goBack
Opens the previous URI in the list of navigated URIs.
WebBrowser.goForward
Opens the next URI in the list of navigated URIs.
WebBrowser.navigate
Opens a URI for the web control.
WebBrowser.paste
Pastes the contents of the system clipboard to the web control.
WebBrowser.reload
Reloads the current URI in the web control.
WebBrowser.selectAll
Selects all the selectable content of the web control.
WebBrowser.selectNone
Deselects all the selected content of the web control.
WebBrowser.showHypertext
Displays hypertext in a the browser control
WebBrowser.stop
Stops the web control from loading a URI that's currently being loaded.
WebBrowser.waitUntilReady
Waits for the web control's current load cycle to finish

Inherited Methods

FormControl.captureMouse
Captures the mouse on this form control.
FormControl.disablePaint
Disables the window from redrawing itself.
FormControl.enablePaint
Enables the window to redraw itself.
FormControl.getBackgroundColor
Gets the background color of the form control.
FormControl.getClientSize
Gets the client size of the form control.
FormControl.getEnabled
Indicates whether or not a form control is enabled.
FormControl.getFont
Gets the default font for the text of form control.
FormControl.getForegroundColor
Gets the foreground color of the form control.
FormControl.getMaxSize
Gets the maximum size of the form control.
FormControl.getMinSize
Gets the minimum size of the form control.
FormControl.getMousePosition
Gets the mouse position relative to this form control.
FormControl.getNativeHandle
Gets the native handle of the window/control
FormControl.getPosition
Gets the position of a form control.
FormControl.getSize
Gets the size of the form control.
FormControl.invalidate
Invalidates a form control, which will cause it to be repainted on the next paint event.
FormControl.refresh
Refreshes a form control, which immediately repaints the entire form control.
FormControl.releaseMouse
Releases the mouse from being captured on this form control.
FormControl.setBackgroundColor
Sets the background color of the form control.
FormControl.setClientSize
Sets the client size of a form control.
FormControl.setEnabled
Enables or disables the form control.
FormControl.setFocus
Sets the focus to the form control.
FormControl.setFont
Sets the default font for the text of the form control.
FormControl.setForegroundColor
Sets the foreground color of the form control.
FormControl.setMaxSize
Sets the maximum size of a form control.
FormControl.setMinSize
Sets the minimum size of a form control.
FormControl.setPosition
Sets the position of a form control relative to the the form control's parent.
FormControl.setSize
Sets the size of a form control.
FormControl.show
Shows or hides the form control.
FormControl.update
Updates a form control, which will immediately repaint any invalid areas.

Example

// create our own class derived from Form
class MyForm extends Form {
    url_textbox = null;
    browser = null;

    constructor() {
        super("Mini Browser", 100, 100, 800, 600);

        this.url_textbox = new TextBox("http://www.google.com", 0, 0, 500);
        this.url_textbox.enterPressed.connect(this, this.onUrlEnterPressed);

        this.browser = new WebBrowser(0, 50, 500, 350);
        this.browser.navigate("http://www.google.com");

        // vertical sizer
        const main_layout = new BoxLayout(Layout.Vertical);
        main_layout.add(this.url_textbox, 0, Layout.Expand | Layout.All, 5);
        main_layout.add(this.browser, 1, Layout.Expand | Layout.Left | Layout.Right | Layout.Bottom, 5);
        this.setLayout(main_layout);
    }

    onUrlEnterPressed() {
        // user pressed enter, navigate to the new location
        this.browser.navigate(this.url_textbox.getText());
    }
}

// create an instance of our derived MyForm class
// and show it
const f = new MyForm();
f.show();

// start the event loop
Application.run();

WebBrowser.canCopyImageContents

function WebBrowser.canCopyImageContents() : Boolean

WebBrowser.canCopyImageLocation

function WebBrowser.canCopyImageLocation() : Boolean

WebBrowser.canCopyLinkLocation

function WebBrowser.canCopyLinkLocation() : Boolean

WebBrowser.canCopySelection

function WebBrowser.canCopySelection() : Boolean

Description

Returns true if there's a selection in the web control that can be copied, and false otherwise.

WebBrowser.canCutSelection

function WebBrowser.canCutSelection() : Boolean

Description

Returns true if there's a selection in the web control that can be cut, and false otherwise.

WebBrowser.canPaste

function WebBrowser.canPaste() : Boolean

Description

Returns true if the current contents of the system clipboard can be pasted, and false otherwise.

WebBrowser.copyImageContents

function WebBrowser.copyImageContents()

WebBrowser.copyImageLocation

function WebBrowser.copyImageLocation()

WebBrowser.copyLinkLocation

function WebBrowser.copyLinkLocation()

WebBrowser.copySelection

function WebBrowser.copySelection()

WebBrowser.cutSelection

function WebBrowser.cutSelection()

WebBrowser.getDOMDocument

function WebBrowser.getDOMDocument()

WebBrowser.getLocation

function WebBrowser.getLocation() : String

Returns

Returns the current URI for the web control.

Description

Returns the current URI for the web control.

WebBrowser.goBack

function WebBrowser.goBack()

Description

Opens the previous URI in the list of navigated URIs.

WebBrowser.goForward

function WebBrowser.goForward()

Description

Opens the next URI in the list of navigated URIs.

WebBrowser.navigate

function WebBrowser.navigate(location : String)

Arguments

location
The location to open in the web control.

Description

Opens the location in the web control.

WebBrowser.paste

function WebBrowser.paste()

WebBrowser.reload

function WebBrowser.reload()

Description

Reloads the current URI in the web control.

WebBrowser.selectAll

function WebBrowser.selectAll()

WebBrowser.selectNone

function WebBrowser.selectNone()

WebBrowser.showHypertext

function WebBrowser.showHypertext(html_text : String) : Boolean

Arguments

html_text
The HTML text that the control should display

Returns

true if the operation succeeded, false otherwise

Description

Display's the text passed in the html_text parameter in the browser control.

WebBrowser.stop

function WebBrowser.stop()

Description

Stops the web control from loading a URI that's currently being loaded.

WebBrowser.waitUntilReady

function WebBrowser.waitUntilReady(max_milliseconds : Number)

Arguments

max_milliseconds
(optional) The number of milliseconds to wait before returning

Description

Calling this method will cause execution to wait until the web browser has finished loading the web document. It is normally invoked after a call to navigate() is issued. The optional parameter, max_milliseconds, specifies the maximum amount of time the call should wait before returning. If no parameter is specified, the method will wait indefinitely.

WebBrowser.navigated