Method question
Peter Brigham MD
pmbrig at gmail.com
Tue Nov 9 14:38:45 EST 2010
On Nov 9, 2010, at 1:48 PM, Glen Bojsza wrote:
> I have a problem which I am not certain which method is valid or
> should be
> used (with Rev / Livecode there are sometimes too many ways of
> achieving a
> goal).
>
> I have a graphic on a card left 62 right 462.
>
> My objective is to allow a user to left click and drag across the
> graphic as
> if selecting a section of it.
>
> I need start left,top,right,bottom and end left,top,right,bottom.
>
> The only interest is knowing the start of the drag when inside the
> graphic
> and the end of the drag inside the graphic... with the following
> caveats.
>
>
> - The user may start the drag either outside the graphic and then
> continue the drag into the graphic (which is the start point) or
> start the
> drag inside the graphic which would be the start point.
> - The user may release the mouse button inside the graphic which
> indicates the stop point or release the mouse button outside the
> graphic
> where the stop point is at the point of the mouse leaving the
> graphic.
>
>
> This seems like it should be simple but I am getting tied down but
> trying to
> over complicate it?
>
> This is for Windows and Linux .
>
> Any elegant or simple solutions out there?
Would this do it?
local uStartPoint, uEndPoint
on mouseenter
if the mouse is down then
put the mouseloc into uStartPoint
end if
end mouseenter
on mouseleave
if the mouse is down then
put the mouseloc into uEndPoint
end if
end mouseleave
on mousedown
put the mouseloc into uStartPoint
end mousedown
on mouseup
put the mouseloc into uEndPoint
end mouseup
Then use the script local variables in whatever handlers for your own
purposes.
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
More information about the use-livecode
mailing list