• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
recognizing NSOKButton on custom sheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

recognizing NSOKButton on custom sheet


  • Subject: recognizing NSOKButton on custom sheet
  • From: Andrew Wilson <email@hidden>
  • Date: Fri, 4 Feb 2005 18:54:39 -0500

I'm using a custom sheet, as described in Apple's docs. It's working, except I can't get the sheetDidEnd method to recognize the buttons on the sheet as NSOKButton and NSCancelButton. I even tried specifically setting the tag of my OK button before starting the sheet, as follows


// these 2 statements are in the method where I want to start the sheet
[newPageOKButton setTag:NSOKButton];
[NSApp beginSheet:newPageSheet modalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil];



- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton) {
// do something (but the if never goes through)
}
[sheet orderOut:self];
}


The buttons call the following action to end the sheet, so I could test the buttons and put my logic there.


- (id)sender
{
[NSApp endSheet:newPageSheet];
if (sender == newPageOKButton) {
NSLog(@"OK button");
}

}


Would it be proper Cocoa style to also order out the sheet in the action method and just omit the sheetDidEnd method? (The tutorial on sheets at CocoaDevCentral does it that way) still like to know how to correctly set it up using NSOKButton, though.

Thanks,

Andrew Wilson
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: recognizing NSOKButton on custom sheet
      • From: Prachi Gauriar <email@hidden>
  • Prev by Date: Re: iWork & spell checking problems
  • Next by Date: Re: recognizing NSOKButton on custom sheet
  • Previous by thread: NSObjectController and the undo manager
  • Next by thread: Re: recognizing NSOKButton on custom sheet
  • Index(es):
    • Date
    • Thread