Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCloud/Popover detachableWindowForPopover example
Function:
Required plugins for this example: MBS MacBase 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: /MacCloud/Popover detachableWindowForPopover example
This example is the version from Thu, 28th Dec 2016.
Project "Popover detachableWindowForPopover example.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control BevelButton1 Inherits BevelButton
ControlInstance BevelButton1 Inherits BevelButton
EventHandler Sub Action() if TargetCocoa = false then MsgBox "This example is only for Cocoa target." end if if NSPopoverMBS.available = false then MsgBox "Please update to Mac OS X 10.7 (Lion)" Return end if if pw<>nil then if pw.detachableWindow <> nil then // detached pw = nil vc = nil cw = nil else // close old pw.performClose cw = nil pw = nil vc = nil end if end if // we use a PopoverWindow instance here just to get the view from there. cw = new PopoverWindow vc = new NSViewControllerMBS vc.view = cw.ContainerControl11.NSViewMBS pw = new MyNSPopoverMBS pw.c = cw.ContainerControl11 pw.animates = true pw.contentViewController = vc pw.behavior = pw.NSPopoverBehaviorSemitransient pw.appearance = pw.NSPopoverAppearanceHUD dim v as NSViewMBS = me.NSViewMBS dim r as NSRectMBS = v.bounds pw.showRelativeToRect(r, v, pw.MaxXEdge) End EventHandler
End Control
Property cw As PopoverWindow
Property pw As MyNSPopoverMBS
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 MyNSPopoverMBS Inherits NSPopoverMBS
EventHandler Function detachableWindowForPopover() As NSWindowMBS // we create another copy of the PopoverWindow with same text to detach dim w as new PopoverWindow if c <> nil then w.ContainerControl11.TextField1.Text = c.TextField1.Text end if detachableWindow = w Return w.NSWindowMBS End EventHandler
Property c As ContainerControl1
Property detachableWindow As window
End Class
Class PopoverWindow Inherits Window
Control ContainerControl11 Inherits ContainerControl1
ControlInstance ContainerControl11 Inherits ContainerControl1
End Control
End Class
Class ContainerControl1 Inherits ContainerControl
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Rectangle1 Inherits Rectangle
ControlInstance Rectangle1 Inherits Rectangle
End Control
Control Oval1 Inherits Oval
ControlInstance Oval1 Inherits Oval
End Control
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
End Control
End Class
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS FileMaker blog