Reputation: 1771
In Carbon you could change a window's visibility with HideWindow(WindowRef) and ShowWindow(WindowRef).
In Cocoa I know you can call NSWindow's orderOut: to hide and orderFront:, orderBack: or orderWindow:relativeTo: to put it back on screen, but none of those respect the ordering of the window relative to other windows when it was last visible.
For example, if I have two windows, one above the other, and then call orderOut: on the back window, how do I show the window again such that it is still behind the front window without calling orderWindow:relativeTo:.
The only thing I can think of right now is to remember the window ID of the window immediately above it and then use orderWindow:relativeTo: when showing it again, but I haven't thought through what happens if the window above is closed before the rear window is made visible again.
Upvotes: 2
Views: 1300
Reputation: 34185
I don't think there's any method available in Cocoa. I guess you need to mimic that using your idea.
By the way, what was the Carbon behavior if you start from four windows ordered as
A B X C D E
Then hide X
A B C D E
Now the user reorders them, and removes some:
E A C
and then show X
again. Where did X
go in Carbon in this case?
Upvotes: 1