On Mar 4, 2010, at 12:49 PM, Kyle Sluder wrote:

> // Warning, typed in mail. Probably won't work.
> @interface MyPanel : NSPanel {
>  BOOL saveVisibility;
> }
> 
> @implementation MyPanel
> - (void)writePreferredVisibilityToUserDefaults:(BOOL)shouldBeVisible {
>  // ...
> }
> 
> - (void)orderWindow:(NSWindowOrderingMode)order 
> relativeTo:(NSInteger)windowNum
> {
>  if (order != NSWindowOut)
>    [self writePreferredVisibilityToUserDefaults:YES];
> 
>  [super orderWindow:order relativeTo:windowNum];
> }
> 
> - (void)performClose:(id)sender {
>  saveVisibility = YES;
>  [super performClose:sender];
> }
> 
> - (void)close {
>  if (saveVisibility)
>    [self writePreferredVisibilityToUserDefaults:NO];
> 
>  [super close];
> }

This potential solution seems to rely on -performClose: being called when the 
user presses the close button. However, in my testing, this method was not 
called. It seemed to me that the intent of -performClose: was to simulate the 
click on the close button, not to respond to it.




_______________________________________________

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