The Visible Hilited Line of a Datagrid
Bob Sneidar
bobsneidar at iotecdigital.com
Fri Sep 7 14:52:22 EDT 2018
The following is fruits of my labors. I am attempting to have a group of two buttons always vertically positioned center-aligned with the hilited line. Here is what I came up with:
on setROControlLoc
put the dgHilitedLine of me into tHilitedLine
put item 1 of the dgVisibleLines of me into tFirstLine
put (tHilitedLine - tFirstLine) into tRowOffset
put the top of group "QuickNotes" into tGridTop
put the dgProp ["header height"] of me into tHeaderHeight
put the dgProp ["row height"] of me into tRowHeight
put the loc of group "grpReorder" into tROControlLoc
put tGridTop + tHeaderHeight + (tRowHeight * (tRowOffset)) + (tRowHeight /2) into tROControlCenter
put tROControlCenter into item 2 of tROControlLoc
set the loc of group "grpReorder" to tROControlLoc
end setROControlLoc
There is probably a much simpler and more elegant wat to go about it, but I can't discern it. I will post a sample stack later. It's pretty cool. The idea is to have a control for moving a line up or down in a datagrid. I considered a drag and drop but it's too much brain power, and this is much easier.
Bob S
> On Sep 7, 2018, at 11:06 , Trevor DeVore via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> Take a look at the dgVisibleLines property. Use dgHilitedLines
> and dgVisibleLines to determine the offset.
>
> --
> Trevor DeVore
More information about the use-livecode
mailing list