Lowest line in datagrid

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
CAsba
Posts: 368
Joined: Fri Sep 30, 2022 12:11 pm

Lowest line in datagrid

Post by CAsba » Sat May 13, 2023 6:59 pm

Hi,
Part of my project involves selecting successive lower lines (going down the lines) in a datagrid, using a 'repeat' procedure. Is there any way that it can be detected that the selected line is the bottom line of the dg ? (Not the 'Last' line, which seems to mean the last inputted line, and not the "lowest".

stam
Posts: 2692
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Lowest line in datagrid

Post by stam » Sat May 13, 2023 7:29 pm

Hi Casba,

I think you need to clarify what you mean:
do you mean the last visible row?
do you mean the last row in of the datagrid?
something else?

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

Re: Lowest line in datagrid

Post by Klaus » Sat May 13, 2023 7:32 pm

Hi CAsba,

not sure, do you mean:

Code: Select all

...
## This will be TRUE if the selected line = the "last" or "lowest" line
if the dgHilitedlines of grp "your dg" = the dgNumberofLines of grp "your dg" then
...
?

Best

Klaus

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

Re: Lowest line in datagrid

Post by Klaus » Sat May 13, 2023 7:41 pm

Hint: Lines in a datagrid are "seen" like lines in a field.
The line at the top is the first line, the line at the bottom is the last line.
"Last" here does not mean the line "last added"!

This still applies when a field or datagrid has been sorted!

CAsba
Posts: 368
Joined: Fri Sep 30, 2022 12:11 pm

Re: Lowest line in datagrid

Post by CAsba » Sat May 13, 2023 11:31 pm

Hi,
Thanks for that. I think I caused some misunderstanding - what I should have said is that when I tried to use the term 'last' in the code the selection moved to the last line to be entered. Anyway, I'm pretty sure that Klaus's solution, using the number of lines, is the answer - I'll try it tomorrow. Many thanks, Klaus, and also for your perc eptiveness in divining what I meant !

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9679
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Lowest line in datagrid

Post by dunbarx » Sun May 14, 2023 1:56 am

CAsba.

I am not particularly expert at all with DataGrids. So I usually simply extract the entirety of its contents using the "dgText" (or dgData"), and deal with that dataSet using "regular" LC gadgetry, In this case you need not restore that dataSet, since you are only looking for information about it.

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”