Resizing During Resizing

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sun Nov 13 12:51:44 EST 2005


Hi Rob,

2 thoughts:

1. The screen is locked while a resizeStack handler is running, so it  
is not necessary to use the lock screen command to prevent changes  
from being seen. (However, the lockScreen property is not set to true.)

2. Xavier is right: working with the rect would be better to preserve  
the topLeft :-)

Best Regards from Paris,

Eric Chatonet.


Le 13 nov. 05 à 18:33, Eric Chatonet a écrit :

> Hi Rob,
>
> just add an "exit to top":
>
> on resizeStack newWidth,newHeight,oldWidth,oldHeight
>   beep
>   lock screen
>   put abs(newWidth-oldWidth) into widthDifference
>   put abs(newHeight-oldHeight) into heightDifference
>   lock messages
>   if widthDifference >= heightDifference then set the height of  
> this stack to trunc((newWidth/3)*2)
>   else set the width of this stack to trunc((newHeight/2)*3)
>
>   exit to top
>
>   unlock messages
>   unlock screen
> end resizeStack
>
> Hope this helps :-)
> Best Regards from Paris,
>
> Eric Chatonet.
>
> PS. Same behaviour with 2.6.1 here.
>
> Le 13 nov. 05 à 17:19, Rob Cozens a écrit :
>
>> Hi All,
>>
>> I want to be able to change the height or width of a stack from  
>> inside the stack's resizeStack handler without triggering a second  
>> resizeStack message.
>>
>> I have created a portfolio of photographs of my wife's art.  All  
>> photos have a 3 (w) to 2 (h) orientation/proportion and the stack  
>> layout is designed to retain same.  In resizeStack, I check to see  
>> whether the user has resized the height to a greater degree than  
>> the width or vice versa, and then change the other dimension to  
>> retain the 3 to 2 proportion.  Here is a test handler based on my  
>> handler:
>>
>> on resizeStack newWidth,newHeight,oldWidth,oldHeight
>>   beep
>>   lock screen
>>   put abs(newWidth-oldWidth) into widthDifference
>>   put abs(newHeight-oldHeight) into heightDifference
>>   lock messages
>>   if widthDifference >= heightDifference then set the height of  
>> this stack to trunc((newWidth/3)*2)
>>   else set the width of this stack to trunc((newHeight/2)*3)
>>   unlock messages
>>   unlock screen
>> end resizeStack
>>
>> When I run this handler I hear two beeps, indicating that a  
>> resizeStack message is sent when a stack dimension is changed,  
>> even though I have locked messages.   I suppose I could add logic  
>> to set and check a local variable; but I'm wondering--
>>
>> 	* Does this happen in 2.6.1?
>> 	* Why does the second resizeStack message get sent when messages  
>> are locked?
>> 	* Why doesn't the logic loop recursively (ie: why doesn't the  
>> second resizeStack message trigger a third)?
>>
>> Rob Cozens CCW
>> Serendipity Software Company
>>
>> "And I, which was two fooles, do so grow three;
>>  Who are a little wise, the best fooles bee."
>>
>>  from "The Triple Foole" by John Donne (1572-1631)
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> ----------------------------------------------------------------
> So Smart Software
>
> For institutions, companies and associations
> Built-to-order applications: management, multimedia, internet, etc.
> Windows, Mac OS and Linux... With the French touch
>
> Free plugins and tutorials on my website
> ----------------------------------------------------------------
> Web site        http://www.sosmartsoftware.com/
> Email        eric.chatonet at sosmartsoftware.com/
> Phone        33 (0)1 43 31 77 62
> Mobile        33 (0)6 20 74 50 86
> ----------------------------------------------------------------
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------




More information about the use-livecode mailing list