Article View: comp.sys.next.programmer
Article #1734Re: NXBrowser problem...
From: Brian Willoughby
Date: Mon, 05 Oct 1992 01:15
Date: Mon, 05 Oct 1992 01:15
43 lines
2587 bytes
2587 bytes
Tim McClarren writes
| I am experiencing a problem with the NXBrowser class under
| 3.0. In effect, the manual page says to use the method "setCellClass:" to
| set the class of the cells that the Browser is to create inside the
| new columns it makes. I then use the "addRow" method of class Matrix
| and it seems that the new cells are in fact NOT of the class I had
| specified. I am subclassing NXBrowserCell, so that isn't the problem
| I don't think. How do I get NXBrowser to behave properly without going
| around it's back and setting the cell prototype in the Matrix like the
| documentation specifically warns against doing?
I posted the answer to this on Sep 14, but it was perhaps obscured among some
other answers - here is a short recap:
After MUCH experimentation under 2.1, I found that -appDidInit: and
-setBrowserOutlet: were not reliable places to make the -setCellClass: call. I
subclassed NXBrowser and included the following class method:
+ initialize
{
[super initialize];
[NXBrowserSub setCellClass:[NXBrowserTextFieldCell class]]; // bogus?
[self setCellClass:[NXBrowserTextFieldCell class]];
return self;
}
This code looks redundant, but that is because I never went back to look at it
until today. I guess the old adage: "don't fix it if it ain't broke" applies
here. I would assume that either line would suffice, but I haven't tested
anything but what appears above.
#mount _soap_box
This is a prime example of how NeXTanswers is nearly useless. appkit.827 says
to -setCellClass inside -initFrame:, appkit.816 says to -setCellClass in
-appDidInit:, appkit.761 says that you must -setCellClass in +initialize
because -init is too late, implying that -appDidInit would be far too late. It
took a great deal of experimentation and searching to figure out what worked.
Of course the simpler approaches didn't work and they were what I tried first.
#dismount _soap_box
--
Brian Willoughby Software Design Engineer, BSEE NCSU
BrianW@SoundS.WA.com Sound Signal Processing Software and Consulting
NeXTmail welcome - NO EMAIL SOLICITATION without prior permission
Technical Details
Message-ID:
<BvMJHB.AEs@sounds.wa.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!nwnexus!sounds!brianwReferences:
<timm.717823827@xongmao>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!nwnexus!sounds!brianw From: BrianW@SoundS.WA.com (Brian Willoughby) Subject: Re: NXBrowser problem... Message-ID: <BvMJHB.AEs@sounds.wa.com> Sender: brianw@sounds.wa.com (Brian Willoughby) Reply-To: BrianW@SoundS.WA.com Organization: SoundSoftware, Bellevue, WA, USA References: <timm.717823827@xongmao> Date: Mon, 5 Oct 1992 01:15:11 GMT Lines: 43