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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to