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



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:

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];


-- 
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice


 _______________________________________________
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: 
 >Moving to Cocoa (From: "Steve Mills" <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.