Page 1 of 1

Is mousedown kosher for Data Grids or not?

Posted: Wed Oct 23, 2019 7:58 pm
by MichaelBluejay
I stumbled across this Data Grid lesson, which says that it's necessary to use on dgMouseDown because on mouseDown will report the wrong selected line.

That was news to me. I'm using on mousedown and I get the correct line with it:

Code: Select all

on mousedown buttonNumber
   if buttonNumber is 3 then
      put the dgDataOfLine[the dgHilitedLine of me] of me into lineArray
      answer lineArray["Description"] -- correct line is reported
  end if
end mousedown
What gives?

BTW, how do I tell when my posts go from "Complete Beginner" to "Experienced Developers"?

Re: Is mousedown kosher for Data Grids or not?

Posted: Wed Oct 23, 2019 8:15 pm
by Klaus
The lesson does NOT say to use "on dgMouseDown", it advises to also call "dgMousedown" in your mousedown handler! 8)
Like this, resp. like the example in that namely lesson:

Code: Select all

on mousedown buttonNumber
   dgmousedown buttonNumber
   if buttonNumber is 3 then
      put the dgDataOfLine[the dgHilitedLine of me] of me into lineArray
      answer lineArray["Description"] -- correct line is reported
  end if
end mousedown
I guess this is neccessary for some initialisation behind the scenes.
And I would take this advice before it might bite you some time later!
BTW, how do I tell when my posts go from "Complete Beginner" to "Experienced Developers"?
No posting gets moved to another forum automatically, so it is up to you to post in the forum of your choice!

Re: Is mousedown kosher for Data Grids or not?

Posted: Wed Oct 23, 2019 8:18 pm
by bogs
MichaelBluejay wrote:
Wed Oct 23, 2019 7:58 pm
BTW, how do I tell when my posts go from "Complete Beginner" to "Experienced Developers"?
Well, I'd say it is based on an individual's perspective.

Simple question about how to locate a word in a field = beginner.

Simple question about the intricacies of deeper workings of the datagrid = probably experienced.

I say that simply based on the fact that people using this language for years often don't fully comprehend the DG. I haven't been here for years, but I don't use it for instance.

Re: Is mousedown kosher for Data Grids or not?

Posted: Wed Oct 23, 2019 10:08 pm
by dunbarx
Michael.

My favorite forum pane is "Talking Livecode". But I often create a post in the beginners section because I oftentimes feel like one. That is, I open a discussion about some aspect of LC that seems dead simple, and I discover that I either have found some arcane issue or simply missed something obvious.

The place to post is up to you, depending on how you feel, or the context in which you want to speak.

Craig

Re: Is mousedown kosher for Data Grids or not?

Posted: Wed Oct 23, 2019 10:23 pm
by Klaus
BTW, how do I tell when my posts go from "Complete Beginner" to "Experienced Developers"?
Sounds like I misunderstand your question.

So I am with Craig:
The place to post is up to you, depending on how you feel, or the context in which you want to speak.

Re: Is mousedown kosher for Data Grids or not?

Posted: Thu Oct 24, 2019 12:39 am
by MichaelBluejay
klaus wrote:The lesson does NOT say to use "on dgMouseDown", it advises to also call "dgMousedown" in your mousedown handler!
Okay, my fault for not reading carefully. Yet my handler does not even call dgMouseDown, and I still get the proper line. I guess I'm wondering if maybe the supposed need to call dgMouseDown was because of a bug that has subsequently been fixed?

Usually my problem is that my code looks like it should work but it doesn't. This is a rare, opposite case in which I have code that seemingly shouldn't work but does. Though we found a similar anomaly in another thread in which on mouseleave was firing in an option menu when the escape key was pressed.

Re: Is mousedown kosher for Data Grids or not?

Posted: Thu Oct 24, 2019 7:33 am
by richmond62
It may not be kosher, but it could be halal.