Looking for datagrid multi line selection advice

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
DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Looking for datagrid multi line selection advice

Post by DavJans » Mon Feb 12, 2018 5:15 pm

In order to select specific lines or multiple lines, you need as far as i know to hold either control or shift on the keyboard. On a windows tablet this is doable, but only with the keyboard visible. This hides half the app. Is there anyway to do it without the keyboard? Can I create a button or check box to do the same thing as holding control or shift? If so, how? Any help would be greatly appreciated.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

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

Re: Looking for datagrid multi line selection advice

Post by dunbarx » Mon Feb 12, 2018 6:09 pm

Hi. In a button script:

Code: Select all

on mouseUp
   set the dgHilitedLines of grp "yourDG" to "2,3"
   end mouseup
Check out the DG API for all these gadgets.

Craig Newman

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

Re: Looking for datagrid multi line selection advice

Post by Klaus » Mon Feb 12, 2018 6:13 pm

Hi Craig,
dunbarx wrote:
Mon Feb 12, 2018 6:09 pm
Hi. In a button script:

Code: Select all

on mouseUp
   set the dgHilitedLines of grp "yourDG" to "2,3"
end mouseup
Check out the DG API for all these gadgets.
Craig Newman
I'm afraid this solution might require a (too) great portion of "clairvoyance"... 8)

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

Re: Looking for datagrid multi line selection advice

Post by dunbarx » Mon Feb 12, 2018 11:10 pm

Klaus.

The "API" part or the handler? If the API, I get it. If the handler, and one should set the "multi Row Hilites" to true, of course, I do not.

I am posting because I know you a little and under what conditions you toss in: 8)

Craig

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

Re: Looking for datagrid multi line selection advice

Post by Klaus » Tue Feb 13, 2018 3:17 am

Hi Craig,

I meant that setting the dghilitedlines by script is surely easy, but the hard part is to catch all the "touches" on mobile for selecting a row without a shift key and THEN set the dghilitedlines accordingly.

After all it was just a joke, with a tiny element of truth. :D


Best

Klaus

DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Re: Looking for datagrid multi line selection advice

Post by DavJans » Wed Mar 21, 2018 9:08 pm

Thank you for the help, I got the following to work.

Shift Button

Code: Select all

on mouseUp
   if the backgroundcolor of me is blue then
      set the backgroundcolor of me to empty
      set the textcolor of me to black
      put empty into allLines
   else
      Set the backgroundcolor of me to blue
      set the textcolor of me to white
      set the backgroundcolor of btn "Ctrl" to empty
      set the textcolor of btn "Ctrl" to black
      end if
end mouseUp
DataGrid

Code: Select all

   if the backgroundcolor of btn "Shift" is blue then
      if allLines is not a number then
         put empty into allLines
      end if
      put the dgHilitedLines of group "DataGrid 7" into newLine
      If allLines is empty then
         put newLine into allLines
      else
         put allLines into newNumber
         if allLines > newLine then
            put allLines - newLine into newLines
            repeat newLines times
               put newNumber - 1 into newNumber
               put newNumber & comma before allLines
               put newLines - 1 into newLines
            end repeat
         else
            put newLine - allLines into newLines
            repeat newLines times
               put newNumber + 1 into newNumber
               put comma & newNumber after allLines
               put newLines - 1 into newLines
            end repeat
         end if
      end if
      set the dgHilitedLines of grp "DataGrid 7" to allLines
   end if
   
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”