scroll in table view

Hi

I have a table view “A” of a scroll view “B” of window “C”. It shows 3 rows (and that is what it can display). If I add a new item (row 4), I want that it scrolls down so that I can see row 2 thru 4. Anyone knows to do that?

Thanks

I think I’ve answered this before, but not sure where?
You can get/set the “float value of vertical scroll of scroll view x of window y”.

Thanks, but if I try
“set float value of vertical scroller of scroll view “B” of window “C” to 4.0” the scroller scrolls down, but the scroll view not (shows row 1 thru 3), even if I tell the table view to update (I can’t tell the scroll view to update)

Thanks

Hmmm… You are true. I’ve tried different things, but can’t find a way to do it… Hope someone else with more Studio knowledge reads this question… Jobu? :wink:

Try this…

tell table view "A" of a scroll view "B" of window "C"
	call method "scrollRowToVisible:" of it with parameters {1}
end tell

I’m pretty sure that table rows are a zero-based index, so the 1 above is actually bringing row 2 into view.

Have fun,
j

Hi

Thanks a lot!!! It works fine and you’re right, it is 0 based. If the scroll view should scroll to the last row, count the data rows of the data source and subtract 1 (because of the 0 based index).

Thanks :smiley: