Re: Opening panel
Re: Opening panel
- Subject: Re: Opening panel
- From: Ondra Cada <email@hidden>
- Date: Mon, 18 Mar 2002 23:15:27 +0100
On Monday, March 18, 2002, at 07:42 , Tomas Zahradnicky, Jr. wrote:
the problem is that I don't have NSPanel* to send this message to.
There is just the object (NSPanel) in your NIB; you bind ("wire",
"ctrl-drag") some outlet to it, and voila! the outlet (after NIB is loaded)
would contain NSPanel*, and could be used directly in [theOutlet
makeKeyAndOrderFront:self].
Can I assume that If I create some controller class in IB and then link
controller's window to my panel, will [[mycontroller alloc] init] display
the panel (or at least have NSPanel*) to tell it to display?
Ouch. Nope. Don't confuse NIBs with some teplates or Classic resources or
whatever.
NIB just *does contain instances* (with pre-initialized contents).
therefore:
(i) You CAN NOT create a class in IB. The "subclass" thing there is just a
shortcut to save some time, but you ALWAYS create classes in source code
in PB (if you used the aforementioned shortcut, you have to make the
appropriate files by "Create Files" in IB).
(ii) If you load a NIB, you just move those instances from a file into
memory (the actual operations might get pretty complicated, but this is
the gist of it);
(iii) if you wanna do anything with any of them instances, well, just bind
some outlet to it, and use it! It's that easy.
(I hope you already understand that if you made _ANOTHER_ controller
instance with [[Controller alloc] init], it would have nothing at all to
do with the controller and panel instances loaded from the NIB.)
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.