Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Moving to Cocoa



On Oct 26, 2007, at 09:09:25, Scott Ribe wrote:

Assuming the nib file is set up normally, with file's owner class being set
to your controller, and its window outlet connected to the window, and the
window's delegate outlet connected to it:

Wow, owner classes and controllers and outlets and delegates. What a freakin' mess. Just to create a window. Looks like I need to start at the beginning again. It's been too long since I went through Learning Cocoa with Objective-C. Is that book now too old? Anything newer, better that explains everything to true blue C++ lovers?


MyController * mc = [MyController initWithWindowNibName: @"MyNib owner:
self];
int ret = [mc doModalDialog];
[[mc window] orderOut: self];
if (ret == ...)
...
[mc release];


And from within your controller, when you wish to end the modal event
processing:

[NSApp stopModalWithCode: NSRunStoppedResponse];

Or

[NSApp stopModalWithCode: NSRunAbortedResponse];

Where of course the code will be returned by the doModalDialog method.

Note that you really probably want the orderOut and release within the
controller logic and not put that responsibility on clients of the dialog.
That first block of code above, I typically put into a class method on the
controller itself, so that clients call, for instance [mController
doMyDialog];

So if you put that 1st hunk of code in the controller, that means that the "self" in the 1st and 3rd lines are referring to the controller? How can that be when the code is the one *making* the controller?


_________________________________________________________
Steve Mills                              Me: 952-401-6255
Senior Software Architect                         MultiAd
email@hidden                       www.multi-ad.com


_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Moving to Cocoa (From: Scott Ribe <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.