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: /Main/Keep Window on Top
This example is the version from Sat, 25th Apr 2014.
Project "Keep Window on Top.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action()
#if TargetCarbon then
static NormalWindowGroup as WindowGroupMBS
static FloatWindowGroup as WindowGroupMBS
#endif
if me.Value then
#if TargetWin32 then
// Windows
self.WinTopMostWindowMBS = true
#elseif TargetCocoa
// Mac OS X Cocoa
dim w as NSWindowMBS = self.NSWindowMBS
w.Level = w.NSStatusWindowLevel
#Elseif TargetCarbon then
// Mac OS X Carbon
// make copy of normal group for later
if NormalWindowGroup = nil then
NormalWindowGroup = self.WindowGroupMBS
end if
// now build a custom group for floating
const kCGBaseWindowLevelKey = 0
const kCGMinimumWindowLevelKey = 1
const kCGDesktopWindowLevelKey = 2
const kCGBackstopMenuLevelKey = 3
const kCGNormalWindowLevelKey = 4
const kCGFloatingWindowLevelKey = 5
const kCGTornOffMenuWindowLevelKey = 6
const kCGDockWindowLevelKey = 7
const kCGMainMenuWindowLevelKey = 8
const kCGStatusWindowLevelKey = 9
const kCGModalPanelWindowLevelKey = 10
const kCGPopUpMenuWindowLevelKey = 11
const kCGDraggingWindowLevelKey = 12
const kCGScreenSaverWindowLevelKey = 13
const kCGMaximumWindowLevelKey = 14
const kCGOverlayWindowLevelKey = 15
const kCGHelpWindowLevelKey = 16
const kCGUtilityWindowLevelKey = 17
const kCGDesktopIconWindowLevelKey = 18
const kCGCursorWindowLevelKey = 19
const kCGNumberOfWindowLevelKeys = 20
if FloatWindowGroup = nil then
FloatWindowGroup = new WindowGroupMBS
FloatWindowGroup.Create(0)
FloatWindowGroup.Level = FloatWindowGroup.LevelForKey(kCGStatusWindowLevelKey)
end if
self.WindowGroupMBS = FloatWindowGroup
#Elseif TargetLinux then
dim g as new GTKWindowMBS(self)
g.SetKeepAbove(true)
#else
?
#endif
else
#if TargetWin32 then
self.WinTopMostWindowMBS = false
#elseif TargetCocoa then
dim w as NSWindowMBS = self.NSWindowMBS
w.Level = w.NSNormalWindowLevel
#Elseif TargetCarbon then
self.WindowGroupMBS = NormalWindowGroup
#Elseif TargetLinux then
dim g as new GTKWindowMBS(self)
g.SetKeepAbove(false)
#else
?
#endif
end if
End EventHandler
End Control
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
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
End Project
The items on this page are in the following plugins: MBS Main Plugin.