Constraining 'grab'

Jan Schenkel janschenkel at yahoo.com
Sun Nov 16 13:00:43 EST 2003


--- Ken Norris <pixelbird at interisland.net> wrote:
> Hi Scott,
> 
> > Date: Sat, 15 Nov 2003 19:12:45 -0800
> > From: Scott Rossi <scott at tactilemedia.com>
> > Subject: Re: Constraining 'grab'
> > 
> > On 11/15/03 6:38 PM, "Ken Norris"
> <pixelbird at interisland.net> wrote:
> > 
> >> In SuperCard I would constrain a 'grab' like
> this:
> >> 
> >> grab me within the rect of grc 2
> >> 
> >> ...in Rev I would say:
> >> 
> >> ?
> > 
> > Searching back through the list archives for
> "constrain", a similar question
> > of appears here:
> > 
> >
>
http://lists.runrev.com/pipermail/use-revolution/2002-March/002682.html
> > 
> > And the oft-proposed solution follows:
> > 
> >
>
http://lists.runrev.com/pipermail/use-revolution/2002-March/002686.html
> ----------
> Well, looks like I asked the same Q about 1.5 years
> ago, which is a little
> embarassing. I guess the solution was a little more
> complicated than I
> expected (and still is for that matter), but at
> least I can understand it a
> little better now.
> 
> The math makes sense of course, but part of the
> solution uses "the mouseV"
> etc., which I though was frowned upon in Rev/MC:
> 
> on mouseDown
>   set the hilite of me to true
>   # STORE SOME SPECS TO REFERENCE IN THE MOUSEMOVE
> HANDLER:
>   # 1) THE CLICK POSITION
>   # 2) THE WIDTH/HEIGHT OF THIS BUTTON
>   # 3) THE RECT OF THE CONSTRAINING BOX
>   set the uAllowDrag of me to \
>       (the mouseH - left of me) & "," & (the mouseV
> - top of me) & "," & \
>       width of me & "," & height of me & "," & \
>       rect of grc 1
> end mouseDown
> 
> ...but I guess it's just a 1-time message, so
> there's no hang time.
> 
> Still, could we substitute a 'send in (time)'
> solution here instead?
> 

Actually, switching to a 'send in (time)' construction
would be counter-productive : a mouseMove is only sent
when the mouse actually moves around ; if you would
check the location every 10 milliseconds or so, it
would pose more strain on the engine, I think.

> I wonder what the chances of getting a constraining
> rect param option for
> the grab command are. Seems like a common enough
> feature to add; I can
> hardly think of a condition where I would _not_ want
> to constrain it in some
> way.
> 
> Ken N.
> 

A parameter to constrain the grab would indeed be a
nice addition to the language. Even nicer would be a
way to simply constrain a control to a certain area.

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


More information about the Use-livecode mailing list