• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Basic question about NSComboBox
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Basic question about NSComboBox


  • Subject: Basic question about NSComboBox
  • From: ADIL SALEEM <email@hidden>
  • Date: Wed, 26 Mar 2008 05:40:26 -0700 (PDT)

I have a  basic question about NSComboBox that i want
to clarify.

When user selects some item from the combo box and
actually click on the item itself in the list then
[comboBox indexOfSelectedItem] returns it's index
correctly (0,1,2...) .

But if the user just clicks on the dropdown button and
not click on any item then [comboBox
indexOfSelectedItem] returns -1, even if there was
previously a selection made by the user.

For example: If a combo box has items

    A
    B
    C

User clicks C and the index of selected item is now 2
But now if the user clicks just the dropdown button
and not any item in the list, then the index of
selected item becomes -1. The item that was previously
selected (C in this case) keeps on displaying,but in
actual nothing is selected. Why is the previous
selection invalidated in such a scenario ? The
previously selected item is still displayed in the
combo box and it gives the impression to the user that
it is still selected whereas it is not.

Currently i am using a workaround for this problem.
Whenever there is a change in selection i save the
index. When i have to use the selected item i first
check if the index of selected item is -1, if it is -1
i use the last saved selection. Is there any better or
more proper solution to this ?


Thank you for your time.





      ____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Windows networking API
  • Next by Date: Re: Writing a preference pane that configures hotkeys?
  • Previous by thread: Re: Changing the line height of an NSTextField?
  • Next by thread: Leopard on PPC
  • Index(es):
    • Date
    • Thread