Native way for discontiguous selection in Data Grid?

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
MichaelBluejay
Posts: 234
Joined: Thu Jul 01, 2010 11:50 am

Native way for discontiguous selection in Data Grid?

Post by MichaelBluejay » Fri Oct 25, 2019 7:05 am

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.

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Native way for discontiguous selection in Data Grid?

Post by Klaus » Fri Oct 25, 2019 9:15 am

Check "multiplelines" in the inspector for your datagrid and CMD-click works as exspected.

MichaelBluejay
Posts: 234
Joined: Thu Jul 01, 2010 11:50 am

Re: Native way for discontiguous selection in Data Grid?

Post by MichaelBluejay » Fri Oct 25, 2019 9:36 am

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.

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Native way for discontiguous selection in Data Grid?

Post by Klaus » Fri Oct 25, 2019 11:29 am

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

MichaelBluejay
Posts: 234
Joined: Thu Jul 01, 2010 11:50 am

Re: Native way for discontiguous selection in Data Grid?

Post by MichaelBluejay » Fri Oct 25, 2019 8:23 pm

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.)

Post Reply