Platforms to show: All Mac Windows Linux Cross-Platform
/MacCloud/Popover window
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacControls 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: /MacCloud/Popover window
This example is the version from Mon, 19th Jul 2020.
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacControls 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: /MacCloud/Popover window
This example is the version from Mon, 19th Jul 2020.
Project "Popover window.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
Note "About"
Example provided by Chris Halford
End Class
Class MainWindow Inherits Window
Control BevelButton1 Inherits BevelButton
ControlInstance BevelButton1 Inherits BevelButton
EventHandler Sub Action()
MyPopover.showmessage TextArea1.Text, Me
If CheckBox1.value Then
timer1.Mode = timer.ModeSingle
Else
timer1.Mode = timer.ModeOff
End If
End EventHandler
End Control
Control myPopover Inherits MacPopover
ControlInstance myPopover Inherits MacPopover
End Control
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action()
myPopover.ClosePopover
End EventHandler
End Control
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
End Control
Property pw As NSPopoverMBS
Property vc As NSViewControllerMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MacPopover
Sub ClosePopover()
If pw<>Nil Then
pw.performClose
pw = Nil
vc = Nil
Return
End If
End Sub
Sub ShowMessage(msg as string, control as RectControl)
If TargetCocoa = False Then Return
If NSPopoverMBS.available = False Then Return
If pw<>Nil Then
ClosePopover
Return
End If
Dim tv As New NSTextFieldMBS(10,10, 180, 50)
tv.StringValue = msg
tv.sizeToFit
tv.Editable = False
Dim rc As NSRectMBS = tv.bounds
'tv.TextColor = NSColorMBS.blackColor
tv.drawsBackground = False
tv.Bordered = False
Dim vv As New NSViewMBS(0,0,rc.Size.Width+40,rc.size.height+20)
vv.addSubview tv
vc = New NSViewControllerMBS
vc.view = vv
pw = New NSPopoverMBS
pw.animates = True
pw.contentViewController = vc
pw.behavior = pw.NSPopoverBehaviorSemitransient
'pw.appearance = pw.NSPopoverAppearanceHUD
Dim v As NSViewMBS = control.NSViewMBS
Dim r As NSRectMBS = v.bounds
pw.animates = True
pw.showRelativeToRect(r, v, pw.MaxXEdge)
End Sub
Property Private pw As NSPopoverMBS
Property Private vc As NSViewControllerMBS
End Class
End Project
See also:
The items on this page are in the following plugins: MBS MacCloud Plugin.
Feedback: Report problem or ask question.