Platforms to show: All Mac Windows Linux Cross-Platform
/Win/HTMLViewer Windows/WebKit - Chromium/HTMLViewer with WebKit on Windows
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 Sun, 15th Feb 2020.
Project "HTMLViewer with WebKit on Windows.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
End EventHandler
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 MainWindow 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
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:
- /Win/HTMLViewer Windows/HTML Editor
- /Win/HTMLViewer Windows/HTMLViewer execCommand
- /Win/HTMLViewer Windows/HTMLViewer Extensions
- /Win/HTMLViewer Windows/HTMLViewer HTML Text and Image
- /Win/HTMLViewer Windows/HTMLViewer Image
- /Win/HTMLViewer Windows/IE Properties
- /Win/HTMLViewer Windows/Load HTML Test
- /Win/HTMLViewer Windows/Reload htmlviewer
- /Win/HTMLViewer Windows/Run JavaScript Function
- /Win/HTMLViewer Windows/WebKit - Chromium/Windows WebKit Cookies
The items on this page are in the following plugins: MBS Win Plugin.