How to tell if a Panel is Open
How to tell if a Panel is Open
- Subject: How to tell if a Panel is Open
- From: "K. Darcy Otto" <email@hidden>
- Date: Mon, 8 Jun 2009 13:08:16 -0700
In my -validateUserInterfaceItem: method, I need to know whether a
particular panel is open (and this panel comes down as a sheet in
front of the main window). How can I determine whether that panel has
come down as a sheet? I have tried the following:
(1) Setting a flag in -windowWillBeginSheet: and cancelling the flag
in -windowWillEndSheet:, and reading that flag in -
validateUserInterfaceItem. The problem is that, for some reason I'm
not entirely grasping, the flag does not persist when read by -
validateUserInterfaceItem:, even though the flag is set up as a BOOL
for the class. This behaviour is really surprising to me.
(2) Testing the condition ([NSApp isKeyWindow] == [NSApp
isMainWindow]), and inferring that the panel is open on NO. The
problem with this is that this returns NO when any panel is open, and
I only want to know when a particular panel is open.
I have the suspicion that the solution to this is easy, but I'm not
quite sure what it is. And if anyone could speculate about why (1) is
occurring, quite independent of how to solve this problem, I would
appreciate it. Thanks.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden