Page 1 of 1

Data Grid Form - snap to selected row

Posted: Tue Mar 28, 2017 8:26 am
by ittarter
Hi all,

I have a data grid form with multiple rows.

When a user selects a row, is it possible to put that row at the visible top of the data grid?

(Kind of like a combo box where when you select an option and that option is the one that becomes the selectedtext.)

More info: I'm making the data grid height 500 while the user looks through the rows and picks one, then I want to shrink it back to height 70, but currently if the user selects a row that is not at the visible top of the data grid, when the height goes back to 70 it isn't showing the hilited row, which is confusing to the user :)

Thanks for any ideas!

Ivan

p.s. I'm just using mouseup right now to trigger the height reset, but obviously mouseup is triggered by other things too, e.g. interacting with the vscrollbar -- is there a command that is triggered ONLY when a user selects a row?

Re: Data Grid Form - snap to selected row

Posted: Tue Mar 28, 2017 10:49 am
by Klaus
Hi ittarter,

check "ScrollLineIntoView" and "ScrollIndexIntoView" in the dictionary for the datagrid.
I think this is what you need in your case.


Best

Klaus

Re: Data Grid Form - snap to selected row

Posted: Tue Mar 28, 2017 2:10 pm
by ittarter
Thanks, Klaus! I must have missed it when I looked through the API. It does the job perfectly!