Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/Draw full red on screen


Required plugins for this example: 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: /MacControls/Draw full red on screen

This example is the version from Sat, 12th May 2017.

Project "Draw full red on screen.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) g.ForeColor = &cFF0000 g.FillRect 0, 0, g.Width, g.Height End EventHandler
End Control
Control NSViewControlMBS1 Inherits NSViewControlMBS
ControlInstance NSViewControlMBS1 Inherits NSViewControlMBS
EventHandler Sub DrawRect(g as NSGraphicsMBS, left as double, top as double, width as double, height as double) dim r as NSColorMBS dim s as NSScreenMBS = NSScreenMBS.mainScreen dim n as NSColorSpaceMBS = s.colorSpace r = NSColorMBS.colorWithColorSpace(n, 1.0, 0.0, 0.0, 1.0) g.setFillColor r g.fillRect new NSRectMBS(left, top, width, height) End EventHandler
EventHandler Sub Open() dim v as NSViewMBS = me.view // disable focus ring v.focusRingType = v.NSFocusRingTypeNone v.needsDisplay = true End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
EventHandler Sub Open() // switch window to use same color space as screen // should this way by default 'dim n as NSWindowMBS = self.NSWindowMBS 'dim s as NSScreenMBS = NSScreenMBS.mainScreen ' 'n.colorSpace = s.colorSpace #if TargetCocoa then // ok #else MsgBox "This exampel is for Mac Cocoa." #endif End EventHandler
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

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


The biggest plugin in space...