dgHilitedLine

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
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

dgHilitedLine

Post by phaworth » Fri Apr 02, 2010 5:33 pm

I think I'm right in saying that if I set the dgHilitedLine of a datagrid in a script it does NOT cause a selectionChanged message to be generated. Is there a way to change that behavior? The selection did change after all.
Thanks,
Pete

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: dgHilitedLine

Post by trevordevore » Fri Apr 02, 2010 9:07 pm

That is correct and it is the intended behavior. This is how selectionChanged works with list fields as well. The docs for selectionChanged explain that it is a message sent when the user makes a change.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: dgHilitedLine

Post by phaworth » Sat Apr 03, 2010 12:57 am

Thanks, just checking if there was a way to change that behavior.
Pete

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: dgHilitedLine

Post by trevordevore » Mon Apr 05, 2010 1:01 pm

You could define your own custom property in the data grid that does what you want. Something like this in the data grid group script might do the trick:

Code: Select all

setProp myDgHilitedLine pLine
    put the dgHilitedLine of me into theOrigLineNo
    set the dgHilitedLine of me to pLine
    dispatch "selectionChanged" to me with pLine, theOrigLineNo
end myDgHilitedLine
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: dgHilitedLine

Post by phaworth » Mon Apr 05, 2010 5:35 pm

Thanks Trevor, I will try that.

Another thing in your example that is very useful to me is that the selectionChanged message has two parameters when it comes from a datagrid! There's no mention of that in the dictionary, although the dictionary doesn't even mention datagrids in it's description of selectionChanged. I see it does mention it in the Datagrid Manual, I wish I had consulted that insetad of the dictionary!

Thanks,
Pete

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: dgHilitedLine

Post by trevordevore » Mon Apr 05, 2010 5:55 pm

Yeah, the dictionary doesn't have any info on the Data Grid. You should consult the manual at http://lessons.runrev.com for the latest information.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Post Reply