Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/HTMLViewer Mac/TestWebKit Flash/TestWebKit Flash
Required plugins for this example: MBS MacBase Plugin, MBS MacCF Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/HTMLViewer Mac/TestWebKit Flash/TestWebKit Flash
This example is the version from Thu, 6th Apr 2016.
Project "TestWebKit Flash.rbp"
Filetype text
Filetype application/pdf
End FileTypes
Class Window1 Inherits Window
Control info Inherits Label
ControlInstance info Inherits Label
End Control
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
End Control
EventHandler Sub EnableMenuItems() FileSavePDF.Enable FileJavascriptTest.Enable FileCurrentURL.Enable FileRefresh.Enable Exception MsgBox "Enablemenuitems exception" End EventHandler
EventHandler Sub Open() dim e as integer dim f as WebFrameMBS dim url as CFURLMBS url=NewCFURLMBSFile(FindFile("teste.swf")) HTMLViewer1.LoadURLMBS url.str.str if not me.Composite then MsgBox "This window must be composite!" end if End EventHandler
Function FileCurrentURL() As Boolean msgbox HTMLViewer1.mainFrameMBS.DataSource.response.URL End Function
Function FileJavascriptTest() As Boolean dim s as string s=HTMLViewer1.EvaluateJavaScriptMBS("return document.title;") if s="" then MsgBox "Error" else MsgBox s end if End Function
Function FileRefresh() As Boolean HTMLViewer1.ReloadMBS Return true End Function
Function FileSavePDF() As Boolean dim f as FolderItem dim d as string dim b as BinaryStream f=GetSaveFolderItem("application/pdf","Webkit output.pdf") if f<>Nil then d=HTMLViewer1.RenderPDFMBS if d<>"" then b=f.CreateBinaryFile("application/pdf") if b<>Nil then b.Write d b.Close end if end if end if Return true End Function
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
End Class
MenuBar MenuBar1
MenuItem UntitledMenu2 = ""
MenuItem FileMenu = "&File"
MenuItem FileSavePDF = "Save PDF..."
MenuItem FileJavascriptTest = "Javascript Test"
MenuItem FileCurrentURL = "Current URL"
MenuItem FileRefresh = "Refresh"
MenuItem UntitledMenu1 = "-"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() if TargetMachO then // ok else MsgBox "This project works only as MachO target on Mac OS X." end if End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

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

MBS FileMaker blog