• 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
Re: delegate of an NWindowController's window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delegate of an NWindowController's window


  • Subject: Re: delegate of an NWindowController's window
  • From: Koen van der Drift <email@hidden>
  • Date: Thu, 29 Sep 2011 20:38:26 -0400

Thanks for the response, but, still not working.


Here's in more detail what I'm trying to do. My main window is controlled by MyAppDelegate:

@interface MyAppDelegate : NSObject <NSApplicationDelegate>


In MyAppDelegate I respond to an IBAction to open a second window to generate some data that needs to be go back to MyAppDelegate to put in my model. The second window is controlled by MyDataWindowController, a subclass of NSWindowController.

- (IBAction)showDataWindow:(id)sender
{
    MyDataWindowController *searchDataWindow  = [[MyDataWindowController alloc]
                                      initWithWindowNibName: @"searchDataWindow"];
    [NSApp beginSheet:[searchDataWindow window]
           modalForWindow:[self window]
            modalDelegate: self
           didEndSelector: nil
              contextInfo: NULL];
}

This all goes fine, the sheet opens and I get generate the data, stored in an NSDictionary in MyDataWindowController. Now I  want somehow to get the data back to MyAppDelegate. So I am trying this in MyDataWindowController:

At the top of MyDataWindowController I add this @protocol:

@protocol MyDataWindowControllerDelegate <NSObject>
- (void)insertData: (NSMutableDictionary *)data;
@end

and then after the data is obtained:

        id <MyDataWindowControllerDelegate> del = [self delegate];      //      <-------

        if ([del respondsToSelector:@selector(insertData:)])
        {
            [del insertData: data];
        }
    }

    [NSApp endSheet: [self window] returnCode: 1];
    [[self window] orderOut: self];

Which now gives the warning:

Semantic Issue: Instance method '-delegate' not found (return type defaults to 'id') on the line with the arrow.



Any suggestions how to make this work?  Maybe not use a delegate?


Thanks,

- Koen.






_______________________________________________

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

  • Follow-Ups:
    • Re: delegate of an NWindowController's window
      • From: Conrad Shultz <email@hidden>
    • Re: delegate of an NWindowController's window
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: applicationWillFinishLaunching
  • Next by Date: Re: Core Data + Undo + Autosave = Instability? Was: … Undo Delete : Cannot fulfill fault
  • Previous by thread: Re: delegate of an NWindowController's window
  • Next by thread: Re: delegate of an NWindowController's window
  • Index(es):
    • Date
    • Thread