Page 1 of 1

Native way for discontiguous selection in Data Grid?

Posted: Fri Oct 25, 2019 7:05 am
by MichaelBluejay
Please tell me there's a way to enable the selection of multiple, non-consecutive lines in the Data Grid?

In every other app I can command-click various lines to hilite them. Not on LC's data grid. I know I can use Shift-click to get consecutive lines, but I (and my users will) also want to be able to do non-consecutive selections.

Re: Native way for discontiguous selection in Data Grid?

Posted: Fri Oct 25, 2019 9:15 am
by Klaus
Check "multiplelines" in the inspector for your datagrid and CMD-click works as exspected.

Re: Native way for discontiguous selection in Data Grid?

Posted: Fri Oct 25, 2019 9:36 am
by MichaelBluejay
I had that selected already, b/c I could select multiple consecutive lines, just not multiple non-consecutive lines.

Anyway, I figured out the problem: There's a data grid lesson that's ironically titled "how to add a mousedown to the data grid without breaking it", because following those instructions is what *breaks* my data grid. The article says I have to add a call to dgMouseDown, but that's what's preventing the discontiguous selections. Once I remove the call to dgMouseDown, I can select discontiguous lines just fine.

So that brings me to the question I asked in the other thread: Is calling dgMouseDown really necessary? The docs say it is, but my code seems to return the correct clicked line without it. I really want to ditch it, because I can't get discontiguous selections when it's present.

Re: Native way for discontiguous selection in Data Grid?

Posted: Fri Oct 25, 2019 11:29 am
by Klaus
You could workaround it by:

Code: Select all

on mousedown buttonNumber
   if the commandkey <> "down" then
      dgmousedown buttonNumber
   end if
  ## your mousedown stuff here...
end mousedown
Tested and works with dis- and contiguous line selection, as far as I can tell.

You should report this (dgmousedown prevents discontiguous selection) as a bug here:
https://quality.livecode.com

Re: Native way for discontiguous selection in Data Grid?

Posted: Fri Oct 25, 2019 8:23 pm
by MichaelBluejay
Thank you, klaus. I should have figured out to move the dgMousedown call to inside an _if_.

I filed a bug report.

Looks like there are over 100 confirmed bugs for the data grid. (Searching "data grid" vs "datagrid" returns a different set of results.)