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?
_______________________________________________
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