Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/Transparent Webview/Transparent WebView
Function:
Required plugins for this example: MBS MacBase 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/Transparent Webview/Transparent WebView
This example is the version from Tue, 23th May 2016.
Project "Transparent WebView.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open() webview=new WebViewMBS(0,0,600,400) webview.autoresizingMask = NSViewMBS.NSViewHeightSizable+NSViewMBS.NSViewWidthSizable webview.autoresizesSubviews=true WebView.drawsBackground=false 'dim url as string = "http://apple.com" 'htm.LoadURL url // does not work dim file as FolderItem file=FindFile("test.html") webview.mainFrame.LoadURL file.URLPath dim winStyle as integer = NSWindowMBS.NSBorderlessWindowMask win=new NSWindowMBS(700,screen(0).height-500,600,400, winStyle,2, false) win.isOpaque=False win.Title = "This is a test Cocoa window" win.showsResizeIndicator = true win.hasShadow=true win.backgroundColor=NSColorMBS.clearColor win.isOpaque=false win.HasShadow=false 'win.AlphaValue=0.0 win.contentView=WebView win.show End EventHandler
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
Property webview As webviewmbs
Property win As nswindowMBS
End Class
Class Window1 Inherits Window
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
End Control
EventHandler Sub Open() HTMLViewer1.LoadPage FindFile("test.html") End EventHandler
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 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
End Project

Feedback, Comments & Corrections

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




Links
MBS FileMaker Plugins