force exit of mouseDown?

Terry Judd tsj at unimelb.edu.au
Thu Jun 23 22:18:29 EDT 2011


If I've got what you're trying to do right then I'd try the following
approach

1. set two script locals on mouseDown - the first that the mouse is down
(pDown) and the second the starting mouseLoc (pLoc)

2. in a mouseMove hander, check if pDown is true and if it is then show a
'selection' graphic (you could have its opaque property set to false or
apply a blend to it) and set the rect of it based on pLoc and the x and y
coordinates passed with mouseMove. This should show your user to see what
would be selected. Additionally, you could iterate through the objects in
your grid to see which ones coincided with the selection and hilite/unhilite
them as your selection changed.

3. in a mouseUp handler, check if your selection graphic is visible and if
it is then (a) get the rect of the selection graphic, (b) hide it and (c)
create a list of individual objects that coincide with it.

4. again in the mouseUp handler set your pDown local to false, lock your
screen and delete all the objects in your list. You probably need a
mouseRelease handler as well - just call your mouseUp handler in it.

HTH,

Terry...



On 24/06/2011 11:26 AM, "Nicolas Cueto" <niconiko at gmail.com> wrote:

> Actually, I'm not sure working with mouseDown is what'll help with what I'm
> after.
> 
> Say there's a grid of grouped objects thus:
> 
>  A. B. C. 
>  D. E. F. 
>  G. H. I. 
>  J. K. L. 
> 
> and underneath that grid is a graphic
> 
>  "gcBkgnd"
> 
> which is opaque and a few pixels larger than the grid.
> 
> The effect I've scripted so far -- and which took much experimenting with
> co-ordinating mouseDown, mouseMove, mouseRelease and mouseUp -- allows the
> user to select the grouped objects by mouse-drag and then have those selected
> objects deleted upon mouse-release.
> 
> Problem is the selected objects should be contiguous. Thus, selecting objects
> J-G-D-A is ok, but not  J-D-A.
> 
> My first idea for a solution was to poll mouseMove in the grouped object's
> script with something like this:
> 
>  on mouseMove
>    if the mouseLoc is not within rect of graphic gcBkgnd then
>     send "doReset" to this card in 50 millisecs
>     exit to top
> 
> I thought "exit to top" would bypass mouseDown, but it doesn't.
> 
> So I then tried the script of the background graphic similarly:
> 
>  on mouseLeave
>    send "doReset" to this card in 50 millisecs
>     exit to top
> 
> But, again, couldn't get away from how mouseDown doesn't allow other
> mouse-related events until it's done.
> 
> Assuming that all makes sense, what should I be doing instead? (And no
> suggestions about fingers or other parts of my anatomy :-) . )
> 
> Thanks
> 
> --
> 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
> 

--
Dr Terry Judd | Senior Lecturer in Medical Education
Medical Education Unit
Melbourne Medical School
The University of Melbourne







More information about the Use-livecode mailing list