Platforms to show: All Mac Windows Linux Cross-Platform

/MacFrameworks/Cocoa Controls/Custom NSView


Required plugins for this example: MBS MacFrameworks Plugin, MBS MacControls Plugin, MBS MacBase Plugin, MBS Main Plugin, MBS MacCocoa Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/Cocoa Controls/Custom NSView

This example is the version from Sun, 17th Mar 2012.

Project "Custom NSView.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control CocoaControlMBS1 Inherits CocoaControlMBS
ControlInstance CocoaControlMBS1 Inherits CocoaControlMBS
EventHandler Function GetView() As NSViewMBS n=new CustomNSView(0,0,me.Width,me.Height) Return n End EventHandler
End Control
EventHandler Sub Open() if not CocoaControlMBS1.Available then MsgBox "This example requires Mac OS X 10.5." quit end if End EventHandler
Property n As CustomNSView
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 CustomNSView Inherits CustomNSViewMBS
EventHandler Sub DrawRect(g as NSGraphicsMBS, left as double, top as double, width as double, height as double) g.SetColorRGB 1.0,0.0,0.0,1.0 g.fillRect left,top,width,height End EventHandler
End Class
End Project

See also:

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


The biggest plugin in space...