resize in browse mode

Ken Ray kray at sonsothunder.com
Tue Dec 28 11:57:20 EST 2004


On 12/27/04 2:51 AM, "Bob Hartley" <rev at armbase.com> wrote:

> Hi Ken and others
> 
> This works partly
> 
>> Ah, that's the problem. In order to trap the mouse going down, you'll need
>> to do one of the following:
>> 
>> 1) Temporarily lock the field by trapping the "mouseWithin" of the field,
>> checking for the state of the alt (option) key and then unlocking the field
>> when the mouse has been released (or moved out of the field); or
>> 
>> 2) Create a separate object at the lower-right corner of the open field
>> (perhaps a transparent button) that can act as a "resizer". This object
>> would move along with the field as it is resized.
>> 
>> Here's an example of the first:
>> 
>> on mouseStillDown
>>   if the optionKey is down then
>>     put the rect of me into tRect
>>     put the mouseH into item 3 of tRect
>>     put the mouseV into item 4 of tRect
>>     set the rect of me to tRect
>>   end if
>> end mouseStillDown
>> 
>> on mouseWithin
>>   if the optionKey is down then
>>     if the lockText of me is false then
>>       set the lockText of me to true
>>     end if
>>   else
>>     if the lockText of me is true then
>>       set the lockText of me to false
>>     end if
>>   end if
>> end mouseWithin
>> 
>> Does this work for you?
> 
> 
> Almost.
> 
> It works for the action I saught but it now stops the earlier grab action
> to move the field with control held (It will resize with alt)
> 
> The full ascript is
> on mouseDown
>     if the controlKey is down then
>       grab me
>       end if
> end mouseDown
>    if the optionKey is down then
>      put the rect of me into tRect
>      put the mouseH into item 3 of tRect
>      put the mouseV into item 4 of tRect
>      set the rect of me to tRect
>    end if
> end mouseStillDown
> 
> on mouseWithin
>    if the optionKey is down then
>      if the lockText of me is false then
>        set the lockText of me to true
>      end if
>    else
>      if the lockText of me is true then
>        set the lockText of me to false
>      end if
>    end if
> end mouseWithin

Well, you're missing the "on mouseStillDown" part of the code; once I added
that in, it works fine (I've checked both Mac and Windows). So it should be:

on mouseDown
    if the controlKey is down then
      grab me
    end if
end mouseDown

on mouseStillDown
    if the optionKey is down then
     put the rect of me into tRect
     put the mouseH into item 3 of tRect
     put the mouseV into item 4 of tRect
     set the rect of me to tRect
   end if
end mouseStillDown

on mouseWithin
   if the optionKey is down then
     if the lockText of me is false then
       set the lockText of me to true
     end if
   else
     if the lockText of me is true then
       set the lockText of me to false
     end if
   end if
end mouseWithin

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list