Data Grid Form - snap to selected row

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
ittarter
Posts: 151
Joined: Sat Jun 13, 2015 2:13 pm

Data Grid Form - snap to selected row

Post by ittarter » Tue Mar 28, 2017 8:26 am

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?

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Data Grid Form - snap to selected row

Post by Klaus » Tue Mar 28, 2017 10:49 am

Hi ittarter,

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


Best

Klaus

ittarter
Posts: 151
Joined: Sat Jun 13, 2015 2:13 pm

Re: Data Grid Form - snap to selected row

Post by ittarter » Tue Mar 28, 2017 2:10 pm

Thanks, Klaus! I must have missed it when I looked through the API. It does the job perfectly!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”