Article View: comp.sys.next.programmer
Article #506Re: Using nibs
From: moose
Date: Fri, 07 Aug 1992 17:36
Date: Fri, 07 Aug 1992 17:36
46 lines
1817 bytes
1817 bytes
In article <1992Aug6.000907.1895@dvorak.amd.com> rpomeroy@aunext3.cam.amd.com
(Ron Pomeroy x(Coop)) writes:
> Hello netters,
>
> I'm still fairly new to the appkit so bear with me.
>
> suppose I don't check to see if infoPanel exists:
>
> - displayInfoPanel:sender
> {
> // if (!infoPanel) {
> [NXApp loadNibSection:"InfoPanel.nib" owner:self];
> // }
> [infoPanel makeKeyAndOrderFront:NULL];
>
> return self;
> }
>
> Now when I hit the Info button in the menu (in the compiled app),
> displayInfoPanel:sender is sent and the nib is unarchived again and again.
>
> My question is - do all of the instances have the same id (i.e. "infoPanel) ?
Yes, and you have a huge memory leak. infoPanel will always point to the last
info panel loaded, clobering your pointers to the other infoPanels. Now, if
you create an object with several id's, then have some code like this
- displayWindow:sender
{
id aNewObject;
[myList addObject:(aNewObject = [[ANewObject alloc] init])];
[NXApp loadNibSection:"InfoPanel.nib" owner:aNewObject];
return self;
}
Then each object would have their id's maintained, and by walking myList you
can get to all the windows you have loaded/created.
--
Michael Rutman | moose@svcdudes.com
Cubist | makes me a NeXT programmer
Software Ventures | maker of MicroPhone II
#include <std.disclaimer>
Technical Details
Message-ID:
<1992Aug7.173645.189@svcdudes.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!psinntp!svc!newsReferences:
<1992Aug6.000907.1895@dvorak.amd.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!svc!news From: moose@svcdudes.com Subject: Re: Using nibs Message-ID: <1992Aug7.173645.189@svcdudes.com> Sender: news@svcdudes.com Reply-To: moose@svcdudes.com Organization: Software Ventures, Inc. References: <1992Aug6.000907.1895@dvorak.amd.com> Distribution: usa Date: Fri, 7 Aug 92 17:36:45 GMT Lines: 46