Platforms to show: All Mac Windows Linux Cross-Platform
/Mac64bit/WebKit2/HTMLViewer Source Data
Required plugins for this example: MBS MacBase Plugin, MBS Mac64bit Plugin, MBS Main Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Mac64bit/WebKit2/HTMLViewer Source Data
This example is the version from Mon, 19th Jul 2020.
Project "HTMLViewer Source Data.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control web Inherits HTMLViewer
ControlInstance web Inherits HTMLViewer
EventHandler Sub Open()
Me.LoadURL "https://www.monkeybreadsoftware.de/xojo/download/plugin/Installation.pdf"
End EventHandler
End Control
Control SaveButton Inherits PushButton
ControlInstance SaveButton Inherits PushButton
EventHandler Sub Action()
Dim w As WKWebViewMBS = web.WKWebViewMBS
dim error as NSErrorMBS
Dim data As MemoryBlock = w.MainResourceData(error)
If error <> Nil Then
MsgBox error.LocalizedDescription
End If
If data <> Nil Then
Dim url As String = w.URL
// write a file
Dim d As String = data
Dim f As FolderItem = SpecialFolder.Desktop.Child("test.pdf")
Dim b As BinaryStream = BinaryStream.Create(f)
b.Write d
b.Close
// launch it
#If XojoVersion >= 2019.02 Then
// API 2.0, raises exception
f.Open(True)
#Else
// API 1.0, sets lasterror code
f.Launch(True)
#EndIf
End If
End EventHandler
End Control
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS Mac64bit Plugin.