MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items Next items

WebViewMBS.Constructor(x as Double, y as Double, w as Double, h as Double, FrameName as string, GroupName as string)
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.7, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Initializes a webview with a frame rectangle, a WebFrame name, and a group name.
Example:
dim w as webviewmbs

w=new WebViewMBS(0,0,800,600,"test","test")

w.LoadHTMLString "Hello World",""

// and later

dim n as NSImageMBS = w.RenderImage
Backdrop=n.CopyPicture
Notes:
The frameName should not be one of the pre-defined frame names (see the WebFrame findFrameNamed for a description of their meaning), but a custom name or a name used in HTML source. The groupName argument is an arbitrary identifier used to group related frames. For example, JavaScript running in a frame can access any other frame in the same group. It's up to the application how it chooses to scope related frames. Both frameName and groupName may be "". This method is the designated initializer for the WebView class.

On success the handle property is not zero.

See also:

WebViewMBS.ContinuousSpellCheckingEnabled as boolean
property, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.7, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Whether continuous spell checking is enabled.
Example:
webview1.ContinuousSpellCheckingEnabled=True
Notes:
True if the object should have continuous spell-checking enabled; otherwise, false.
Available in Mac OS X v10.3.9 and later.
(Read and Write computed property)
WebViewMBS.copy
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 9.3, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Action method that copies the selected content to the general pasteboard.
Notes:
This action method copies the selected content onto the general pasteboard, in as many formats as the receiver supports. For example, a plain text object uses NSStringPboardType for plain text, and a rich text object also uses NSRTFPboardType.

Available in Mac OS X v10.3.9 and later.
WebViewMBS.copyFont
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 9.3, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: An action method that copies font information onto the font pasteboard.
Notes:
This action method copies the font information for the first character of the selection (or for the insertion point) onto the font pasteboard as NSFontPboardType.

Available in Mac OS X v10.3.9 and later.
WebViewMBS.CustomTextEncodingName as String
property, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: The custom text encoding name.
Notes:
On getting:
The custom text encoding name or "" if no custom text encoding name has been set.

On setting:
Make the page display with a different text encoding; stops any load in progress.
The text encoding passed in overrides the normal text encoding smarts including what's specified in a web page's header or HTTP response.
The text encoding automatically goes back to the default when the top level frame changes to a new location.
Setting the text encoding name to nil makes the webView use default encoding rules.
(Read and Write computed property)
WebViewMBS.CustomUserAgent as String
property, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: The custom user-agent string or nil if no custom user-agent string has been set.
Example:
webview1.CustomUserAgent="HelloWorldBrowser"
Notes: (Read and Write computed property)
WebViewMBS.cut
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 9.3, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: An action method that deletes selected content and puts it on the general pasteboard.
Notes:
This action method deletes the selected content and places it onto the general pasteboard, in as many formats as the receiver supports. For example, a plain text object uses NSStringPboardType for plain text, and a rich text object also uses NSRTFPboardType.

Available in Mac OS X v10.3.9 and later.
WebViewMBS.dashboardBehavior(behavior as Integer) as boolean
property, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.8, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Get or set the htmlviewer behavior.
Notes:
This is a private API from Apple which may break in the future.
It seems to exist for the dashboard application to switch some flags for event handling.

Behavior constants:
const WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows = 0
const WebDashboardBehaviorAlwaysSendActiveNullEventsToPlugIns = 1
const WebDashboardBehaviorAlwaysAcceptsFirstMouse = 2
const WebDashboardBehaviorAllowWheelScrolling = 3
const WebDashboardBehaviorUseBackwardCompatibilityMode = 4
(Read and Write computed property)
WebViewMBS.delete
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 9.3, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: An action method that deletes the selected content.
Notes:
The pasteboard is unaffected by invoking this method.

Available in Mac OS X v10.3.9 and later.
WebViewMBS.deleteBackward
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to delete the selection, if there is one, or a single element backward from the insertion point (a letter or character in text, for example).
WebViewMBS.deleteBackwardByDecomposingPreviousCharacter
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to delete the selection, if there is one, or a single character backward from the insertion point.
Notes: If the previous character is canonically decomposable, this method should try to delete only the last character in the grapheme cluster (for example, deleting "a"+ "'" results in "a"). NSResponder declares but does not implement this method.
WebViewMBS.deleteForward
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to delete the selection, if there is one, or a single element forward from the insertion point (a letter or character in text, for example).
WebViewMBS.deleteSelection
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Deletes the receiver's current selection unless it's collapsed.
Notes: No content is removed if the current selection is collapsed (a range is selected with the same nodes and offsets for the start and end) or if there is no current selection.
WebViewMBS.deleteToBeginningOfLine
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to delete the selection, if there is one, or all text from the insertion point to the beginning of a line (typically of text).
Notes: Also places the deleted text into the kill buffer.
WebViewMBS.deleteToBeginningOfParagraph
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to delete the selection, if there is one, or all text from the insertion point to the beginning of a paragraph of text.
Notes: Also places the deleted text into the kill buffer.
WebViewMBS.deleteToEndOfLine
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to delete the selection, if there is one, or all text from the insertion point to the end of a line (typically of text).
Notes: Also places the deleted text into the kill buffer.
WebViewMBS.deleteToEndOfParagraph
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to delete the selection, if there is one, or all text from the insertion point to the end of a paragraph of text.
Notes: Also places the deleted text into the kill buffer.
WebViewMBS.deleteWordBackward
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to delete the selection, if there is one, or a single word backward from the insertion point.
WebViewMBS.deleteWordForward
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to delete the selection, if there is one, or a single word forward from the insertion point.
WebViewMBS.DrawsBackground as Boolean
property, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Enable or disable the background drawing.
Notes:
Works only with Webkit on Mac OS X 10.3.9 and newer.
Returns false on unsupported Webkit versions.
If you set it to false, the background is not drawn and you can have transparent websites like the Dashboard widgets.
(Read and Write computed property)
WebViewMBS.Editable as boolean
property, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 9.4, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Whether the user is allowed to edit the document.
Notes:
You can change the receiver's document programmatically regardless of this setting.
Available in Mac OS X v10.3.9 and later.

Normally, an HTML document is not editable unless the elements within the document are editable. This method provides a low-level way to make the contents of a WebView object editable without altering the document or DOM structure.

True if the receiver allows the user to edit the document. False if an element in the receiver's document can be edited only if the CONTENTEDITABLE attribute has been set on the element or one of its parent elements.
(Read and Write computed property)
WebViewMBS.EstimatedProgress as Double
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: An estimate of the percent complete for a document load.
Example:
// waits till rendering is done:
dim f as FolderItem = SpecialFolder.Desktop.Child("test.html")

WebView.mainFrame.LoadURL f.URLPath

while WebView.EstimatedProgress>0
DelayMBS 0.1
wend

// this works only because EstimatedProgress is set to 0.1 by LoadURL
// and set back to zero when the load process finishes.
// If future Webkit versions change the EstimatedProgress results,
// it will break.
Notes: This value will range from 0 to 1.0 and, once a load completes, will remain at 1.0 until a new load starts, at which point it will be reset to 0. The value is an estimate based on the total number of bytes expected to be received for a document, including all it's possible subresources. For more accurate progress indication it is recommended that you implement a WebFrameLoadDelegate and a WebResourceLoadDelegate.
WebViewMBS.EvaluateJavaScript(code as string) as string
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Runs the given java script and returns the result.
Example:
// shows current user agent string which the control sends to website
MsgBox webview1.EvaluateJavaScript("navigator.userAgent;")

// using eval:
MsgBox webview1.EvaluateJavaScript("eval(""x=10;y=20;x*y"")")

// with function:
MsgBox webview1.EvaluateJavaScript(" test(); function test() { x = 10 ; y = 20; return x * y;}")

// with multiline script:
dim s as string = "test();"+EndOfLine+_
"function test()"+EndOfLine+_
"{ "+EndOfLine+_
" x = 10; "+EndOfLine+_
" y = 20; "+EndOfLine+_
" return x * y;"+EndOfLine+_
"}"

MsgBox webview1.EvaluateJavaScript(s)
Notes:
Returns "" on any error.

In Safari 2 we used "return 1+2;" while in Safari 3 we only need "1+2;". The return is no longer needed. Be aware that there is an implicit return now with Safari 3!
WebViewMBS.GoBack
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Go back to the previous URL in the backforward list.
WebViewMBS.GoForward
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Go forward to the next URL in the backforward list.
WebViewMBS.goToBackForwardItem(item as WebHistoryItemMBS) as boolean
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Moves on the history to the given item.
Notes: Returns true on success or false on failure.
WebViewMBS.GroupName as string
property, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 7.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: The group name for this WebView.
Notes:
JavaScript may access named frames within the same group.
(Read and Write computed property)
WebViewMBS.HTMLText as string
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns HTML text for this document.
Notes: This is the text as we generate it from current DOM tree. It is not the html text we loaded from the website. To get this original html text, please use mainFrameMBS.dataSource.data instead.
WebViewMBS.indent
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to indent the selection or the insertion point if there is no selection.
WebViewMBS.insertBacktab
method, HTMLViewer Mac, MBS CocoaControls Plugin (HTMLViewerWeb), class WebViewMBS,
Plugin version: 12.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Implemented by WebView to handle a backward tab.
Notes: A field editor might respond to this method by selecting the field before it, while a regular text object either doesn't respond to or ignores such a message.

Previous items Next items

The items on this page are in the following plugins: MBS CocoaControls Plugin.




Links
MBS Xojo Chart Plugins