[comp.sys.next] About popUpLists

wab@sumex-aim.stanford.edu (William A. Brown) (08/25/89)

About popUpLists

I have some trouble using removeItem: and removeItemAt: when that item 
is displayed on the button. 

Question: How can you remove an item that is selected?

I would also like to select items from the program itself like:

   SelectItemAt:(int)index
   Performs in the same way as if the item was selected with mouse by the
user.

Any codeexample in the intended direction would be appreciated.

Thanks

jpd00964@uxa.cso.uiuc.edu (08/26/89)

/* Written  4:50 pm  Aug 24, 1989 by wab@sumex-aim.stanford.edu in uxa.cso.uiuc.edu:comp.sys.next */
/* ---------- "About popUpLists" ---------- */
>About popUpLists
>
>I have some trouble using removeItem: and removeItemAt: when that item 
>is displayed on the button. 

Are you also changing the title of the button?  If you don't, you'll only
reinsert the item into the popupList when the button is selected

>Question: How can you remove an item that is selected?

Can you elaborate.  What do you mean remove?  What does the button say when
you "remove" it?  Selecting an item usually means to set a value, not remove
it. 

>
>I would also like to select items from the program itself like:
>
>   SelectItemAt:(int)index
>   Performs in the same way as if the item was selected with mouse by the
>user.
>

You do this by setting the title to the text you want selected.  So if item
3 has the text "normal", you would get the text for item 3 and set the title
of the button to normal.  One pitfall to watch for, if you set the title to 
something out of your list, you will get an addition to your list at the
top.

Michael Rutman
Softmed