Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/HTMLViewer Windows/WebKit - Chromium/HTMLViewer with WebKit on Windows
Function:
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/HTMLViewer Windows/WebKit - Chromium/HTMLViewer with WebKit on Windows
This example is the version from Tue, 30th Jan 2017.
Project "HTMLViewer with WebKit on Windows.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Function UnhandledException(error As RuntimeException) As Boolean MsgBox Introspection.GetType(error).fullname+EndOfLine+error.Message+_ EndOfLine+EndOfLine+Join(error.Stack, EndOfLine) Return true End EventHandler
End Class
Class Window1 Inherits Window
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
EventHandler Sub Open() Me.LoadUrl "https://www.mbsplugins.de/" End EventHandler
EventHandler Sub TitleChanged(newTitle as String) Self.Title = newTitle End EventHandler
End Control
Control ReloadButton Inherits PushButton
ControlInstance ReloadButton Inherits PushButton
EventHandler Sub Action() // Take a look at the cef_browser_t structure in cef_browser_capi.h // The reload method is 44 bytes down this structure, hence the 44 you see here dim c as ChromiumBrowserMBS = HTMLViewer1.ChromiumBrowserMBS if c<>Nil then c.Reload end if End EventHandler
End Control
Control TextButton Inherits PushButton
ControlInstance TextButton Inherits PushButton
EventHandler Sub Action() dim b as ChromiumBrowserMBS = HTMLViewer1.ChromiumBrowserMBS if b<>Nil then dim m as ChromiumFrameMBS = b.mainFrame if m<>Nil then dim t as string = m.text dim w as new TextWindow w.TextArea1.Text = t end if end if End EventHandler
End Control
Control Sourcebutton Inherits PushButton
ControlInstance Sourcebutton Inherits PushButton
EventHandler Sub Action() dim b as ChromiumBrowserMBS = HTMLViewer1.ChromiumBrowserMBS if b<>Nil then dim m as ChromiumFrameMBS = b.mainFrame if m<>Nil then dim t as string = m.Source dim w as new TextWindow w.TextArea1.Text = t end if end if End EventHandler
End Control
Control PictureButton Inherits PushButton
ControlInstance PictureButton Inherits PushButton
EventHandler Sub Action() dim b as ChromiumBrowserMBS = HTMLViewer1.ChromiumBrowserMBS if b<>Nil then dim w as integer = b.width dim h as integer = b.height dim m as Picture = b.Image(w, h) if m<>Nil then dim p as new PicWindow p.Backdrop = m end if end if End EventHandler
End Control
Control ScriptButton Inherits PushButton
ControlInstance ScriptButton Inherits PushButton
EventHandler Sub Action() dim b as ChromiumBrowserMBS = HTMLViewer1.ChromiumBrowserMBS if b<>Nil then dim f as ChromiumFrameMBS = b.MainFrame if f<>Nil then f.ExecuteJavaScript("alert('Hello');", "", 1) end if end if End EventHandler
End Control
Control URLButton Inherits PushButton
ControlInstance URLButton Inherits PushButton
EventHandler Sub Action() dim b as ChromiumBrowserMBS = HTMLViewer1.ChromiumBrowserMBS if b<>Nil then MsgBox b.MainFrame.URL end if End EventHandler
End Control
Control VersionText Inherits Label
ControlInstance VersionText Inherits Label
EventHandler Sub Open() me.Text = RBVersionString End EventHandler
End Control
Delegate Private Function CefGetRefCount(cefBrowser As Ptr) As integer
Delegate Private Sub CefReload(cefBrowser As Ptr)
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class PicWindow Inherits Window
End Class
Class TextWindow Inherits Window
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
End Class
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins