wWebView

This control may be used to render web (HTML / CSS / javascript) documents. As an embedded internet explorer, you can use getComObject() to get a winim COM object with IWebBrowser2 interface and then do a lot of thing on it. For example, manipulate DOM, call javascript function, and so on.

By default, the control runs in compatibility view mode (IE7). To change the compatibility mode, you need to deal with the registry key: FEATURE_BROWSER_EMULATION.

Notice: wWebView is always re-enabled before wEvent_WebViewLoaded event. If you need a disabled control, disable it again in the event handler of wEvent_WebViewLoaded.

Superclass:wControl
Styles:
StylesDescription
wWvNoSelDoes not enable selection of the text.
wWvNoScrollDoes not have scroll bars.
wWvNoContextMenuDoes not have context menus.
wWvNoFocusDoes not receive focus.
wWvSilentDoes not display dialog boxes (script error, etc.).
Events:wWebViewEvent

Types

wWebViewError = object of wError
  
An error raised when webview operation failure.

Consts

wWvNoSel = 1
wWvNoScroll = 2
wWvNoContextMenu = 4
wWvNoFocus = 8
wWvSilent = 16

Procs

proc navigate(self: wWebView; url: string; noHistory = false) {...}{.validate, raises: [],
    tags: [].}
Navigating the given url.
proc runScript(self: wWebView; code: string) {...}{.validate, raises: [], tags: [].}
Runs the given javascript code. This function discard the result. If you need the result from the javascript code, use eval instead. For example:
var obj = webView.getComObject()
echo obj.document.script.call("eval", "1 + 2 * 3")
proc getHtml(self: wWebView): string {...}{.validate, property, raises: [], tags: [].}
Get the HTML source code of the currently displayed document.
proc setHtml(self: wWebView; html: string) {...}{.validate, property, raises: [], tags: [].}
Set the displayed page HTML source to the contents of the given string.
proc canGoBack(self: wWebView): bool {...}{.validate, inline, raises: [], tags: [].}
Returns true if it is possible to navigate backward.
proc canGoForward(self: wWebView): bool {...}{.validate, inline, raises: [], tags: [].}
Returns true if it is possible to navigate forward.
proc goBack(self: wWebView) {...}{.validate, inline, raises: [], tags: [].}
Navigate back.
proc goForward(self: wWebView) {...}{.validate, inline, raises: [], tags: [].}
Navigate forward.
proc refresh(self: wWebView) {...}{.validate, inline, raises: [], tags: [].}
Navigate forward.
proc stop(self: wWebView) {...}{.validate, inline, raises: [], tags: [].}
Stop the current page loading process.
proc isBusy(self: wWebView): bool {...}{.validate, raises: [], tags: [].}
Returns whether the web control is currently busy.
proc getCurrentUrl(self: wWebView): string {...}{.validate, property, raises: [], tags: [].}
Get the URL of the currently displayed document.
proc getCurrentTitle(self: wWebView): string {...}{.validate, property, raises: [], tags: [].}
Get the title of the current web page, or its URL/path if title is not available.
proc getText(self: wWebView): string {...}{.validate, property, raises: [], tags: [].}
Get the text of the current page.
proc getSelectedHtml(self: wWebView): string {...}{.validate, property, raises: [], tags: [].}
Returns the currently selected HTML source.
proc getSelectedText(self: wWebView): string {...}{.validate, property, raises: [], tags: [].}
Returns the currently selected text.
proc clearSelection(self: wWebView) {...}{.validate, raises: [], tags: [].}
Clears the current selection.
proc selectAll(self: wWebView) {...}{.validate, inline, raises: [], tags: [].}
Selects the entire page.
proc canCopy(self: wWebView): bool {...}{.validate, inline, raises: [], tags: [].}
Returns true if the current selection can be copied.
proc copy(self: wWebView) {...}{.validate, inline, raises: [], tags: [].}
Copies the current selection.
proc final(self: wWebView) {...}{.raises: [], tags: [].}
Default finalizer for wWebView.
proc init(self: wWebView; parent: wWindow; id = wDefaultID; pos = wDefaultPoint;
         size = wDefaultSize; style: wStyle = 0) {...}{.validate, raises: [], tags: [].}
Initializer.
proc WebView(parent: wWindow; id = wDefaultID; pos = wDefaultPoint; size = wDefaultSize;
            style: wStyle = 0): wWebView {...}{.inline, discardable, raises: [], tags: [].}
Constructor, creating and showing a webview.

Methods

method getDefaultSize(self: wWebView): wSize {...}{.property, raises: [], tags: [].}
Returns the default size for the control.
method getBestSize(self: wWebView): wSize {...}{.property, raises: [], tags: [].}
Returns the best acceptable size for the control.

Templates

template getComObject(self: wWebView): untyped
Returns a winim COM object with IWebBrowser2 interface. Import winim/com before using this template.
template comObject(self: wWebView): untyped
The same as getComObject().