Page 1 of 1

Looking for datagrid multi line selection advice

Posted: Mon Feb 12, 2018 5:15 pm
by DavJans
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.

Re: Looking for datagrid multi line selection advice

Posted: Mon Feb 12, 2018 6:09 pm
by dunbarx
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

Re: Looking for datagrid multi line selection advice

Posted: Mon Feb 12, 2018 6:13 pm
by Klaus
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)

Re: Looking for datagrid multi line selection advice

Posted: Mon Feb 12, 2018 11:10 pm
by dunbarx
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

Re: Looking for datagrid multi line selection advice

Posted: Tue Feb 13, 2018 3:17 am
by Klaus
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

Re: Looking for datagrid multi line selection advice

Posted: Wed Mar 21, 2018 9:08 pm
by DavJans
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