Article View: comp.sys.next.programmer
Article #44Re: PopUpList Question
From: Drew Davidson
Date: Wed, 28 Oct 1992 16:51
Date: Wed, 28 Oct 1992 16:51
51 lines
2551 bytes
2551 bytes
In article <7584@transfer.stratus.com> charlie@snowflake.az.stratus.com writes:
> In article <1992Oct27.153629.16802@pencom.com> msanford@finn
> (Mike Sanford) writes:
> >
> > This is the deal. I want to remove the items from a popuplist
> and put in
> > new items. The following method does not work correctly.
> >
> > - deleteAllItems:aPopUpList
> > {
> > while ([aPopUpList count])
> > [aPopUpList removeItemAt:0];
> > return self;
> > }
> >
> > Execution does leave the method making me think that
> aPopUpList is empty,
> > however, the item that is selected when this methods is
> invoked is not
> > removed.
> >
> > I guess I could programmatically (yuk!) create a new popUpList
> and replace
> > the old one, but that still doesn't answer my question about
> why my method
> > doesn't work correctly.
> >
> > - Mike
>
> I have exactly that code in one of my apps and it works
> correctly. Are you sure that aPopUpList is not nil?
>
> --
> Charles Spitzer
> charlie@snowflake.az.stratus.com
> Telecom Customer Assistance Center
> Stratus Computer, Inc.
> Phoenix, AZ 85018
The docs state that if an item in the PopUpList does not exist that has the
same title as the title of the Button that called it, the PopUpList will add
the title to itself. That's what's happening - you are really removing
everything from the PopUpList, but when you click on it again it is inserting
the title of the Button into the PopUpList.
--
+--------------------------------+-------------------------------------------+
| Drew Davidson | "Never ask a programmer if he'll have |
| Software Guy | another cup of coffee because it's |
| First National Bank of Chicago | nobody's damn business how much he's |
| drew@fnbc.com (NeXTmail) | already had!" - me |
+--------------------------------+-------------------------------------------+
Technical Details
Message-ID:
<1992Oct28.165110.4483@fnbc.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!network.ucsd.edu!usc!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!sunic!psinntp!psinntp!juliet!newsReferences:
<7584@transfer.stratus.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!network.ucsd.edu!usc!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!sunic!psinntp!psinntp!juliet!news From: drew@fnbc.com (Drew Davidson) Subject: Re: PopUpList Question Message-ID: <1992Oct28.165110.4483@fnbc.com> Sender: news@fnbc.com Reply-To: drew@fnbc.com Organization: First National Bank Of Chicago, Chicago IL, USA References: <7584@transfer.stratus.com> Date: Wed, 28 Oct 92 16:51:10 GMT Lines: 51