PDA

View Full Version : NSTableView pre-selected row view problem




Eraserhead
Feb 19, 2010, 11:01 AM
I have an NSTableView where I'm pre-selecting a row before it is displayed, however although the row is selected in the table it isn't actually displayed to the user. How do you do that?

Thanks



JoshDC
Feb 19, 2010, 11:32 AM
How do you mean it's selected but not displayed to the user? Do you mean the table view returns the correct selectedRow but it isn't highlighted, or is it highlighted but the user has to scroll down to see it? If it's the latter case you can use scrollRowToVisible: with the selectedRow. Otherwise I don't know what the issue would be unless I know how and where you're doing the preselecting.

Eraserhead
Feb 19, 2010, 11:36 AM
Do you mean the table view returns the correct selectedRow but it isn't highlighted,

No.

or is it highlighted but the user has to scroll down to see it?

Yes.

If it's the latter case you can use scrollRowToVisible: with the selectedRow.

Awesome, that works perfectly.