FROM : ADIL SALEEM
DATE : Wed Mar 26 13:40:26 2008
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
DATE : Wed Mar 26 13:40:26 2008
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
| Related mails | Author | Date |
|---|---|---|
| No related mails found. | ||






Cocoa mail archive

