Data Grid and mouseEnter - mouseLeave

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
D4vidrim
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 61
Joined: Fri May 31, 2013 9:32 am

Data Grid and mouseEnter - mouseLeave

Post by D4vidrim » Wed Dec 04, 2013 10:42 am

Hi,
I' created a Data Grid and on its script I wrote this code:

Code: Select all

on mouseEnter
   --lock screen
   if the mouseLoc is within the rect of me then
      put the top of me into theTop
      set the height of me to 126
      set the top of me to theTop
   end if
end mouseEnter

on mouseLeave
   --lock screen
   --wait 1 sec
   if the mouseLoc is not within the rect of me then
      put the top of me into theTop
      set the height of me to 19
      set the top of me to theTop
   end if
end mouseLeave
What I'm trying to do is to reduce its height when the mouse is not within the rect of the data grid, my code sometimes does work, but sometimes id doesn't.
For example, if I move too fast the mouse or if I move the mouse on the top of the grid, the mouseLeave message is not delivered (or something else happens...).

Can someone help me, please?

Thank you.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Data Grid and mouseEnter - mouseLeave

Post by jmburnod » Wed Dec 04, 2013 11:30 am

Hi D4vidrim

I tested your script and it works for me.
Maybe you can take off the condition "if the mouseLoc"

Which version of LiveCode do you use ?

Best regards
Jean-marc
https://alternatic.ch

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Data Grid and mouseEnter - mouseLeave

Post by bangkok » Wed Dec 04, 2013 11:51 am

I've got the same issue.

When the mouse is leaving at the top of the datagrid... nothing happens.

it works down, right, left (but not all the time, it's not consistent), but by the top never.

I tried LC 6.5, 6.1, 5.5... same results.

*********
Ah ! I just found a pattern !

On the right side of the DG.... increase the size... So there is a blank header between the last column of the DG and the right edge of the DG.
Now... leave by the top.. the script is fired.

So... the script is not fired... when you leave the DG by the top, within a column.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Data Grid and mouseEnter - mouseLeave

Post by jmburnod » Wed Dec 04, 2013 12:39 pm

Sorry,
I tried with a table fld.
I've got also strange result with datagrid
the datagrid is shaked when i move from top to down
https://alternatic.ch

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

Re: Data Grid and mouseEnter - mouseLeave

Post by Klaus » Wed Dec 04, 2013 2:44 pm

Hi guys,

sorry, no solution, but some explanations :D

Since this is the script of the datagrid group, EVERY singel object will also exectue it, so when moving the mouse
over the datagrid, every control in the datagrid (and there are MANY of them!) will execute mouseenter/mouseleave
or at least try it, unless they do have their own mouseenter/leave scripts!

That's why Jean-Marc is experiencing this "shaking"!
Shake, shake, shake
Shake yout booooooooty! :D


Best

Klaus

Post Reply