DoubleDutch wrote:I personally think it should be up to the programmer to respect or not respect convention.
Of course, I just don't think it should be the default setting.
You can add or remove a child window.
Code: Select all
#NSWindowAbove = 1
#NSWindowBelow = -1
OpenWindow(1,100,100,400,300,"parent window")
OpenWindow(2,200,200,400,300,"child window")
CocoaMessage(0, WindowID(1), "addChildWindow:", WindowID(2), "ordered:", #NSWindowAbove)
Debug CocoaMessage(0, WindowID(2), "parentWindow")
CocoaMessage(0, WindowID(1), "removeChildWindow:", WindowID(2))
Debug CocoaMessage(0, WindowID(2), "parentWindow")
CocoaMessage(0, WindowID(1), "addChildWindow:", WindowID(2), "ordered:", #NSWindowAbove)
Debug CocoaMessage(0, WindowID(2), "parentWindow")
Repeat
Event=WaitWindowEvent()
If Event=#PB_Event_CloseWindow
Quit=#True
EndIf
Until Quit
Second example
Code: Select all
Procedure SetParentWindow(Window, NewParent)
Protected ID = WindowID(Window)
Protected OldParent = CocoaMessage(0, ID, "parentWindow")
If OldParent
CocoaMessage(0, OldParent, "removeChildWindow:", ID)
EndIf
If IsWindow(NewParent)
CocoaMessage(0, WindowID(NewParent), "addChildWindow:", ID, "ordered:", 1)
EndIf
EndProcedure
OpenWindow(1,100,100,400,300,"parent window1")
OpenWindow(2,200,200,400,300,"parent window2")
OpenWindow(3,300,300,400,300,"child window")
SetParentWindow(3, 1); Set parent of window 3 to window 1
Delay(1000)
SetParentWindow(3, 2); Set parent of window 3 to window 2
Delay(1000)
SetParentWindow(3, -1); Set parent of window 3 to none (not existing window)
Delay(1000)
Repeat
Event=WaitWindowEvent()
If Event=#PB_Event_CloseWindow
Quit=#True
EndIf
Until Quit