Is mousedown kosher for Data Grids or not?

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
MichaelBluejay
Posts: 245
Joined: Thu Jul 01, 2010 11:50 am

Is mousedown kosher for Data Grids or not?

Post 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"?
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Is mousedown kosher for Data Grids or not?

Post 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!
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Is mousedown kosher for Data Grids or not?

Post 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.
Image
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10509
Joined: Wed May 06, 2009 2:28 pm

Re: Is mousedown kosher for Data Grids or not?

Post 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
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Is mousedown kosher for Data Grids or not?

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

Re: Is mousedown kosher for Data Grids or not?

Post 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.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: Is mousedown kosher for Data Grids or not?

Post by richmond62 »

It may not be kosher, but it could be halal.
Post Reply