MouseMove strangeness

Dave Cragg dcragg at lacscentre.co.uk
Sat Jun 5 17:29:58 EDT 2004


At 2:41 pm -0400 5/6/04, Howard Bornstein wrote:
>I'm trying to write a handler that resizes the contents of a group
>when the group border is resized. Say the group consists off a field
>and a button. Within the group script I've put this:
>
>on mousemove
>   set the rectangle of fld 1 to the rectangle of me
>end mousemove
>
>If I change the group size manually (without this script inside) and
>then execute the set rectangle command from the message box, it acts
>as expected: the field sizes to the size of the group border.
>However, when I use the mousemove handler, as soon as the mouse
>cursor enters the group borders, both the group and field sizes
>start expanding automatically. They will eventually expand off the
>screen.

A group will normally resize to accommodate its contents. If the 
group has a margin setting > 0 (and probably a borderWidth > 0) this 
means that as the field rect gets set to the group rect, the group 
will then expand again to retain its margins and border settings.

There are probably a number of ways to achieve what you want, but it 
will depend on your specific circumstances. For example, how/when is 
the group resized? By script, or by the user dragging on a border?

Possible ways:

Set the margins (and borderwidth) of the group to 0.
Set the lockLocation of the group to true. (May need to be toggled if 
the group resizing is done manually.)
Instead of resizing the group, just resize the field.
Instead of resizing the group, use a "dummy object" such as a graphic 
and resize that, then set the rect of the field to the rect of the 
"dummy object".

Cheers
Dave


More information about the use-livecode mailing list