The Visible Hilited Line of a Datagrid

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

The Visible Hilited Line of a Datagrid

Bob Sneidar via use-livecode
It must be late in the day, but I am having a hard time getting the VISIBLE hilited line of a table datagrid. I can do the math based on the scroll and all that, but what I want is for example, in a scrolled datagrid, the user clicks on the first visible line. I want to return 1, or if the second visible line I want to return 2. I was given to understand that when scrolling, the fields are drawn from scratch, but their names reflect their index and NOT their visible position in the scrolled grid!

Any ideas?

Bob S


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: The Visible Hilited Line of a Datagrid

Bob Sneidar via use-livecode
I don't have the dictionary handy, so check it for this, but I thought the:

dgHilitedIndex is the record number in the array
and
dgHilitedLine was the visible line number?

Look up dgHilitedLine vs dgHilitedIndex


On 9/6/2018 7:38 PM, Bob Sneidar via use-livecode wrote:

> It must be late in the day, but I am having a hard time getting the VISIBLE hilited line of a table datagrid. I can do the math based on the scroll and all that, but what I want is for example, in a scrolled datagrid, the user clicks on the first visible line. I want to return 1, or if the second visible line I want to return 2. I was given to understand that when scrolling, the fields are drawn from scratch, but their names reflect their index and NOT their visible position in the scrolled grid!
>
> Any ideas?
>
> Bob S
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: The Visible Hilited Line of a Datagrid

Bob Sneidar via use-livecode
That's what I thought but apparently they are equal, and understandably, because otherwise you would not be able to reference a line that was not currently visible. but I think if you resort, the indexes change order but the lines are still the actual lines.

I am figuring out a way to do this by calculating the dgHilitedLine against the dgVscroll.

Bob S


> On Sep 6, 2018, at 17:59 , Paul Dupuis via use-livecode <[hidden email]> wrote:
>
> I don't have the dictionary handy, so check it for this, but I thought the:
>
> dgHilitedIndex is the record number in the array
> and
> dgHilitedLine was the visible line number?
>
> Look up dgHilitedLine vs dgHilitedIndex


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: The Visible Hilited Line of a Datagrid

Bob Sneidar via use-livecode
In reply to this post by Bob Sneidar via use-livecode
On Thu, Sep 6, 2018 at 6:38 PM Bob Sneidar via use-livecode <
[hidden email]> wrote:

> It must be late in the day, but I am having a hard time getting the
> VISIBLE hilited line of a table datagrid. I can do the math based on the
> scroll and all that, but what I want is for example, in a scrolled
> datagrid, the user clicks on the first visible line. I want to return 1, or
> if the second visible line I want to return 2. I was given to understand
> that when scrolling, the fields are drawn from scratch, but their names
> reflect their index and NOT their visible position in the scrolled grid!
>

Take a look at the dgVisibleLines property. Use dgHilitedLines
and dgVisibleLines to determine the offset.

--
Trevor DeVore
ScreenSteps
www.screensteps.com
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: The Visible Hilited Line of a Datagrid

Bob Sneidar via use-livecode
Thanks Trevor! I swear I scoured the API and never saw that!

Bob S


> On Sep 7, 2018, at 11:06 , Trevor DeVore via use-livecode <[hidden email]> wrote:
>
>> It must be late in the day, but I am having a hard time getting the
>> VISIBLE hilited line of a table datagrid. I can do the math based on the
>> scroll and all that, but what I want is for example, in a scrolled
>> datagrid, the user clicks on the first visible line. I want to return 1, or
>> if the second visible line I want to return 2. I was given to understand
>> that when scrolling, the fields are drawn from scratch, but their names
>> reflect their index and NOT their visible position in the scrolled grid!
>>
>
> Take a look at the dgVisibleLines property. Use dgHilitedLines
> and dgVisibleLines to determine the offset.
>
> --
> Trevor DeVore


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: The Visible Hilited Line of a Datagrid

Bob Sneidar via use-livecode
In reply to this post by Bob Sneidar via use-livecode
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 <[hidden email]> wrote:
>
> Take a look at the dgVisibleLines property. Use dgHilitedLines
> and dgVisibleLines to determine the offset.
>
> --
> Trevor DeVore


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode