FROM : Keith Blount
DATE : Tue Mar 04 18:43:54 2008
Hi,
Hopefully this is a simple one:
I have an NSTableView, one column of which uses NSPopUpButtonCell and has its content bound to one NSArrayController which controls an array of list item strings for selection. Its selectedIndex is bound to the property of a different array controller. The actual index that gets loaded in may be beyond the number of items in the list array (as it may previously have been associated with a different list). In this case, the table view just shows an empty cell.
This is okay, but what I'd really like is to set a default selection index in this case. i.e. If the selectedIndex of the object >= [popupListArray count], then set it to select the last (or first) item (i.e. so that internally it is doing something like, if (selectedIndex >= [popupListArray count]) { selectedIndex = [popupListArray count]-1; } ). I thought I might be able to do this automatically using the "No selection" or "Not applicable" placeholder, but it turns out that it doesn't quite work like that. Is there a way of setting this up automatically, or near-to-automatically?
Many thanks in advance,
Keith
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
DATE : Tue Mar 04 18:43:54 2008
Hi,
Hopefully this is a simple one:
I have an NSTableView, one column of which uses NSPopUpButtonCell and has its content bound to one NSArrayController which controls an array of list item strings for selection. Its selectedIndex is bound to the property of a different array controller. The actual index that gets loaded in may be beyond the number of items in the list array (as it may previously have been associated with a different list). In this case, the table view just shows an empty cell.
This is okay, but what I'd really like is to set a default selection index in this case. i.e. If the selectedIndex of the object >= [popupListArray count], then set it to select the last (or first) item (i.e. so that internally it is doing something like, if (selectedIndex >= [popupListArray count]) { selectedIndex = [popupListArray count]-1; } ). I thought I might be able to do this automatically using the "No selection" or "Not applicable" placeholder, but it turns out that it doesn't quite work like that. Is there a way of setting this up automatically, or near-to-automatically?
Many thanks in advance,
Keith
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
| Related mails | Author | Date |
|---|---|---|
| No related mails found. | ||






Cocoa mail archive

