MouseEnter while down

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3458
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

MouseEnter while down

Post by richmond62 » Tue Jan 01, 2019 4:37 pm

OK, OK; let's be direct and to the point:

I want to "rip off" the functionality of this web-page:
http://terpstrakeyboard.com/about/
-
Terps.png
Terps.png (97.59 KiB) Viewed 762 times
-
Click on the "Play It Now!" menu item and follow through . . .
You will end up with a microtonal keyboard that has this functionality:

1. When one performs a mouseDown on each hexagon a tone is played.

2. While the mouse button is held down the tone continues to sound.

3. If the mouse is dragged (while being pressed) from one hexagon to the next,
the sound changes from that of the initial hexagon to the new one.

So . . . there would seem to be something "there" that is a bit difficult to implement in LiveCode.

I have 2 adjacent hexagons, called "h1" and "h2" containing these scripts, respectively:

Code: Select all

on mouseDown
    set the backgroundColor of me to red
end mouseDown
on mouseStillDown
    set the backgroundColor of me to green
end mouseStillDown
on mouseLeave
    set the backgroundColor of me to white
end mouseLeave

Code: Select all

on mouseDown
    set the backgroundColor of me to blue
end mouseDown
on mouseStillDown
    set the backgroundColor of me to yellow
end mouseStillDown
on mouseLeave
    set the backgroundColor of me to white
end mouseLeave
Dragging one's mouse while it is "down" from "h1" to H2" does not turn "h2" yellow!

THIS is the functionality I am looking for.

I replaced on mouseStillDown with mouseWithin to no avail.

At present there seems to be no way I can detect the presence of a mouse pointer
inwith an object if it has been dragged from outwith that object while its left button
has been depressed.
Attachments
mouseEnter test.livecode.zip
Here's my test stack
(950 Bytes) Downloaded 28 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3458
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: MouseEnter while down

Post by richmond62 » Tue Jan 01, 2019 4:47 pm

As intersect does NOT allow the mouseLoc to be one of its factors this sort of cardScript does not work:

Code: Select all

on mouseMove
   if intersect(mouseLoc,grc"h3",5) then
      send "XYZ" to grc "h3"
      end if
end mouseMove

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3458
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: MouseEnter while down

Post by richmond62 » Tue Jan 01, 2019 4:49 pm

When a pointer, whether in the mouseDown or mouseUp
state enters the area of an object it should be detected
in such a way that the programmer can use that information.

bogs
Posts: 3698
Joined: Sat Feb 25, 2017 10:45 pm

Re: MouseEnter while down

Post by bogs » Tue Jan 01, 2019 5:27 pm

I haven't had the time to look into this seriously, but I am surprised you can't get that to work with already existing tools and functions. You already tried my first 2 ideas though. Hmmm...
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3458
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: MouseEnter while down

Post by richmond62 » Tue Jan 01, 2019 6:57 pm

Over on the Use-List Paul Dupuis wrote something about drag

Mais depuis je n'ai pas un object rien n'a fonctionné.
-
ruPaul.jpg
ruPaul.jpg (8.4 KiB) Viewed 726 times

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5084
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: MouseEnter while down

Post by jacque » Wed Jan 02, 2019 8:29 pm

A couple of others gave suggestions on the list too. One used Animation Engine to calculate the math for the hexagons, but the LC engine seems to do that by itself now if the control is a polygon graphic. I suggested a solution there too, but here's a slightly revised one that works a little better:

Code: Select all

local sColor
local sDragging

on mouseDown
  put the cColor of the mouseControl into sColor
  set the backcolor of the mouseControl to sColor
  put true into sDragging
end mouseDown

on mouseUp
  put false into sDragging
end mouseUp

on mouseMove x,y
  if sDragging then
    get x,y -- force to variable
    put controlAtLoc(it) into tControl
    if tControl <> "" then
      set the backcolor of tControl to sColor
    else
      put false into sDragging
    end if
  end if
end mouseMove

on mouseRelease
  put false into sDragging
end mouseRelease

on mouseLeave
 put false into sDragging
end mouseLeave
Your question on the list asked for color changes, so you'd need to tinker with audio instead if that's where you're headed.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Feature Requests”