Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS MacBase Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/Tooltip
This example is the version from Thu, 10th Jan 2018.
Project "Tooltip.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Out Inherits Canvas
ControlInstance Out Inherits Canvas
EventHandler Sub Open()
dim w as integer = me.Width
dim h as integer = me.Height
dim ww as integer = w / 2
dim hh as integer = h / 2
dim view as NSViewMBS = me.NSViewMBS
dim t1 as new MyNSViewTooltipMBS
t1.Text = "blue"
dim r1 as new NSRectMBS(0, 0, ww, hh)
view.addToolTipRect r1, t1
tooltips.Append t1
dim t2 as new MyNSViewTooltipMBS
t2.Text = "gray"
dim r2 as new NSRectMBS(ww, 0, ww, hh)
view.addToolTipRect r2, t2
tooltips.Append t2
dim t3 as new MyNSViewTooltipMBS
t3.Text = "red"
dim r3 as new NSRectMBS(0, hh, ww, hh)
view.addToolTipRect r3, t3
tooltips.Append t3
dim t4 as new MyNSViewTooltipMBS
t4.Text = "green"
dim r4 as new NSRectMBS(ww, hh, ww, hh)
view.addToolTipRect r4, t4
tooltips.Append t4
End EventHandler
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect)
dim w as integer = g.Width
dim h as integer = g.Height
dim ww as integer = w / 2
dim hh as integer = h / 2
g.ForeColor = &cFF9999
g.FillRect 0, 0, ww, hh
g.ForeColor = &c99FF99
g.FillRect ww, 0, ww, hh
g.ForeColor = &c9999FF
g.FillRect 0, hh, ww, hh
g.ForeColor = &c999999
g.FillRect ww, hh, ww, hh
End EventHandler
End Control
Property tooltips() As MyNSViewTooltipMBS
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
Class MyNSViewTooltipMBS Inherits NSViewTooltipMBS
EventHandler Function stringForToolTip(point as NSPointMBS) As string
Return me.Text + " " + str(point.X)+"/"+str(point.Y)
End EventHandler
End Class
End Project
The items on this page are in the following plugins: MBS MacControls Plugin.