Re: [Pyobjc-dev] Re: Multiple Nibs
Brought to you by:
ronaldoussoren
From: b.bum <bb...@ma...> - 2004-05-08 03:07:33
|
On May 7, 2004, at 7:06 PM, Bob Ippolito wrote: > The showMyModalPanel looks suspicious otherwise, because if this is > something coming from interface builder with outlets and such then you > shouldn't be creating the objects yourself, they should be coming from > the nib. In this case, I think the problem is that the second NIB file isn't actually loaded (unless there is some code missing). The line of code that reads.... > NibClassBuilder.extractClasses("MyModalPanel") ... doesn't actually load the NIB itself, it just makes sure the various classes found in the NIB are defined within the runtime. You will still need something like... if not NSBundle.loadNibNamed_owner_("MyModalPanel", self): print "nib loading error" ... which is the normal Cocoa way of loading NIBs and lets you load the NIB multiple times if you need to display multiple instances of the NIBs contents (multiple document applications work this way). What Bob said about calling init() does definitely hold. If you are just doing alloc().init(), I would recommend simply using new() to minimize code and confusion: foo = MyClass.new() # same as foo = MyClass.alloc().init() b.bum |