Code: Select all
OpenWindow(0, 0, 0, 300, 300, "Center Screen", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Code: Select all
OpenWindow(0, 0, 0, 300, 300, "Center Screen", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Code: Select all
OpenWindow(0, 0, 0, 300, 300, "Center Screen", #PB_Window_SystemMenu)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Code: Select all
OpenWindow(0, 0, 0, 300, 300, "Center Screen", #PB_Window_SystemMenu)
CocoaMessage(0,WindowID(0),"center")
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Code: Select all
ExamineDesktops()
Procedure TryToCenterTheWindow(window)
; not 100% centered on Y axis because of titlebar
Protected xPos = (DesktopWidth(0) / 2) - (WindowWidth(window) / 2)
Protected yPos = (DesktopHeight(0) / 2) - (WindowHeight(window) / 2)
ResizeWindow(window, xPos, yPos, #PB_Ignore, #PB_Ignore)
EndProcedure
OpenWindow(0, 0, 0, 300, 300, "Center Screen", #PB_Window_SystemMenu)
TryToCenterTheWindow(0)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow