object beneath mouseLoc?

Dick Kriesel dick.kriesel at mail.com
Mon Jul 4 15:13:54 EDT 2011


Hi, Nicolas.  Your problem sounded familiar, so I found a relevant previous post.  Does it work for you?



On 3/19/07 3:38 AM, "Dick Kriesel" <dick.kriesel at mail.com> wrote:

> Here's another technique for identifying the object at the mouseLoc. This
> technique is different because it works with no repeat loop, no checking the
> visible or the rect of any object, no formulas based on the mouseLoc, and no
> reference to the mouseControl.
> 
> Create a button named "mouseObject" with the following script:
> 
> -- <script>
> local sMouseObject
> 
> on mouseObject
>  if line 1 of the frontscripts is not long id of me then
>    insert script of me into front
>    lock screen
>    click at the mouseloc
>    unlock screen
>    remove script of me from front
>    return sMouseObject
>  end if
> end mouseObject
> 
> on mousedown
> end mousedown
> 
> on mouseUp
>  put long id of the target into sMouseObject
> end mouseUp
> -- <script/>
> 
> Then to test it, put the following handler into the stack script:
> 
> -- <script>
> on mouseMove
>  call "mouseObject" of button "mouseObject" of me
>  put the result
> end mouseMove
> -- <script/>
> 
> The technique passed my tests.  Does it work for you?
> 
> -- Dick





















On Jul 3, 2011, at 10:09 PM, Nicolas Cueto wrote:

> Hello.
> 
> Does LC have a built-in way of returning the id of the object(s) at a mouseLoc?
> 
> For now, I'm relying on mouseMove combined with mouseColor. But on my stack there's a weakness to this method. (It's a grid of round-edged tiles each of which can be deleted if contiguously connected. A diagonal move between tiles, though, enters the clearing between the rounded corners and causes mouseColor to trigger.)
> 
> As always, thank you for the help.
> --
> Nicolas Cueto (iPhone)
> _______________________________________________
> 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