MouseDown on Enter

Alex Tweedly alex at tweedly.net
Tue Jan 1 21:39:06 CET 2019


First I would consider whether you want *exactly* that UI, or whether 
something very similar would do.

If similar is OK, then I would invert the logic of the UI:

  - if the mouse (pointer) is over a hexagon, and the mouse is not being 
pressed - play that note, and keep playing it

  - if mouse moves into another hex, change note

  - when the mouse is pressed - and for as long as it stays pressed - 
play nothing.

That is very easy to do (at least, without testing it :,)  :

each hexagon has handlers that do :

on mouseenter
    -- do whatever it is you do to play a note (??)
end mouseenter

on mouseup
    -- do whatever it is you do to play a note (??)
end mouseup

on mouseleave
     -- stop playing the current note
end mouseleave


(actually, probably easier to do single handlers, which check "the 
target" to determine which hex is being entered/left). Note that whne 
you move form one to another, it's

and the card/group has a handler

on mousedown
    -- stop playing the current note
end mousedown

and that, I think,  should be all you need..


However - I'm not sure that's a very intuitive UI ("release to play"), 
so I'd probably go the extra mile and do the harder one that replicates 
the original UI. And that *is* harder, so I will try it out before I say 
any more about it ...


On 01/01/2019 15:23, Richmond via use-livecode wrote:
> 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/
>
> 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:
>
> ...
>
> 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.
>
Right - won\t work because H2 never gets a mouseEnter or mouseDown 
because the mouse was already down when it moved into H2.

I will have a play later tonight and see what I can come up with
Alex.
> Richmond.
>
>
>
>
>
>
>
>
> On 29.12.18 18:52, J. Landman Gay via use-livecode wrote:
>> MouseDown is a message, not a function. You need:
>>
>>  if the mouse is down then
>>    set the...etc.
>> -- 
>> Jacqueline Landman Gay | jacque at hyperactivesw.com
>> HyperActive Software | http://www.hyperactivesw.com
>> On December 29, 2018 9:07:37 AM Richmond via use-livecode 
>> <use-livecode at lists.runrev.com> wrote:
>>
>>> This does *NOT* work:
>>>
>>> on mouseEnter
>>>    if mouseDown then
>>>       set the backgroundColor of me to red
>>>    else
>>>       set the backgroundColor of me to green
>>>    end if
>>> end mouseEnter
>>>
>>> on mouseLeave
>>>    set the backgroundColor of me to white
>>> end mouseLeave
>>>
>>> which is a "right pox"
>>>
>>> Richmond.
>>>
>>> On 29.12.18 16:45, Richmond wrote:
>>>>
>>>> This may rank as one of the goofiest questions I've ever asked: Oh,
>>>> well, here goes:
>>>>
>>>> Imagine a mosaic of faux buttons if you will.
>>>>
>>>> Each of these buttons will play a tone if I drag my mouse into it:
>>>>
>>>> on mouseEnter
>>>>
>>>>   play audioClip "x.aiff"
>>>>
>>>> end mouseEnter
>>>>
>>>> All well and good . . .
>>>>
>>>> BUT, Richmond wants more . . .
>>>>
>>>> I want to get different results from a simple mouseEnter
>>>>
>>>> and a mouseEnter while the left-click button is down.
>>>>
>>>> Richmond.
>>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your 
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list