Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/Background view over titlebar
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: /MacCocoa/Background view over titlebar
This example is the version from Sun, 17th Mar 2012.
Project "Background view over titlebar.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
EventHandler Sub Open() v = new myview(0, 0, 500, 330) w = new NSWindowMBS(self) dim sv as NSViewMBS = w.contentView.superview dim sa(-1) as NSViewMBS = sv.subviews sv.addSubview v, v.NSWindowBelow, sa(0) w.show End EventHandler
Property v As myview
Property w As NSWindowMBS
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 MyView Inherits CustomNSViewMBS
EventHandler Sub DrawRect(g as NSGraphicsMBS, left as double, top as double, width as double, height as double) g.setFillColor NSColorMBS.redColor.colorWithAlphaComponent(0.5) g.fillRect left, top, width, height, g.NSCompositeSourceOver End EventHandler
EventHandler Function acceptsFirstMouse(e as NSEventMBS) As boolean Return true End EventHandler
EventHandler Function acceptsFirstResponder() As boolean Return true End EventHandler
EventHandler Function otherMouseDown(e as NSEventMBS, x as double, y as double) As boolean MsgBox "Clicked in MyView." Return true End EventHandler
End Class
End Project

Feedback, Comments & Corrections

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

MBS Xojo PDF Plugins