On Aug 30, 2011, at 10:30 PM, Guy Halford-Thompson wrote:

> I have created the window in IB and also created a custom class
> (MyWindow).  in IB I have given the window class MyWindow.
> 
> I have added a couple of extra functions to MyWindow and now I wish to
> trigger the window to be displayed given certain conditions.
> 
> How can I display the window?

You need to know which object is being called when the condition is met, and 
that object has to have a pointer to your window so it can call it. Generally 
you’d wire a connection in Interface Builder from that object to your window, 
so the object will have an instance variable pointing to the window.

In a simple app the object that’s doing stuff is most likely the application 
delegate object, so you’d add an instance variable of type MYWindow*, put the 
IBOutlet keyword on it so IB knows it can be wired to, and then control-drag a 
connection from the window to the app delegate. Now when a method of the app 
delegate is called (like some menu-triggered action) it can use that instance 
variable to call the window.

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to