scaling and positioning proportionally an object at the same time

Dave dave at looktowindward.com
Thu Apr 19 09:43:15 EDT 2007


Hi,

The problem is that one day you will be changing your stack and not  
doing anything with the GM and then suddenly *BANG* all your objects  
will disappear off into the land of nod! They will still be in the  
stack but their positions will be wild values like Top, Left =  
25467,9456 and the only way to get the objects back inside the stacks  
display area will be to delete all geometry on all objects and then  
manually set their coordinates back inside the visible stack area  
again. If you have a lot of objects this can take a *long* time and  
is especially annoying if you have spent ages getting all the  
positions "just-right".

Having being burnt like this a few times, I, along with most others  
that have been using RunRev for a while don't go near the GM. It's  
just not worth the risk.

If you *must* use GM you could at least protect yourself a bit by  
adding some code like this to each object:

if the cpGMSaveRect of me = empty then
put the rect of me into the cpGMSaveRect of me
end if

Then run this once for each object once you have got all the  
positioning right. At least then, if and when the GM goes Beswick you  
can restore the original rectangle easily enough.

Just using GM and trusting it without question is like playing  
Russian Roulette!

All the Best
Dave

On 19 Apr 2007, at 14:14, Christian Langers wrote:

> Merci beaucoup Eric !
>
> Well I found a way to combine the GM and scripting (I read your  
> tutorial...)
>
> Well, I think the GM is good enough for minor use / basic things...  
> and scripting stays the best way...
>
>
>
> Greets,
>
> Christian
>
>
>
>
> Début du message réexpédié :
>
>> De : Eric Chatonet <eric.chatonet at sosmartsoftware.com>
>> Date : 18 avril 2007 15:47:47 GMT+02:00
>> À : How to use Revolution <use-revolution at lists.runrev.com>
>> Objet : Rép : scaling and positioning proportionally an object at  
>> the same time
>> Répondre à : How to use Revolution <use-revolution at lists.runrev.com>
>>
>> Bonjour Christian,
>>
>> Le 18 avr. 07 à 15:18, Christian Langers a écrit :
>>
>>> Hello,
>>>
>>> I try since hours to do this :
>>>
>>> I have an image (photo) on a stack which scales to the right and  
>>> down on resizing the stack (via Geometry Manager); I have a  
>>> graphic (rectangle) placed at a precise location on the image  
>>> (the user selects a portion of the image to hilite something on it);
>>>
>>> Now I want that when the user resizes the window the graphic  
>>> scales and moves (up/down) proportionaly to the image , so that  
>>> the rectangle grows and shrinks with the image hiliting always  
>>> the same portion of the image (e.g. an eye of a face); I hope you  
>>> follow (it's difficult to explain this in English)...
>>>
>>> I tried to use the GM in REv, but ...brrr... the graphic jumps  
>>> away from its original position when resizing...
>>> So... please ! Heeeelp... This is getting me on my nerves ;-)
>>> Thanks for any suggestions or solutions...
>>>
>>> Christian
>>> from Luxembourg
>>
>> Actually don't trust the Geometry Manager and prefer to write your  
>> own routines in a resizeStack handler ;-)
>> Here is, for instance, an excerpt from such a handler:
>>
>> on resizeStack pNewW,pNewH,pOldW,pOldH -- note params passed by  
>> Rev ;-)
>>   global gPrefs
>>   -----
>>   if gPrefs["uAdds"] then ProportionalWResize the long name of img  
>> "ToolbarShadow",pNewW,114
>>   else ProportionalWResize the long name of img  
>> "ToolbarShadow",pNewW,0
>>   pass resizeStack
>> end resizeStack
>>
>> And:
>>
>> on ProportionalWResize pObj,pNewW,pDelta
>>   local tRect
>>   -----
>>   put the rect of pObj into tRect
>>   put pNewW - pDelta into item 3 of tRect
>>   set the rect of pObj to tRect
>> end ProportionalWResize
>>
>> Of course, the above example is simple and, sometimes, it might  
>> appear more tricky...
>> But actually, Rev allows to script any complex resizing in any  
>> case ;-)
>> Good luck!
>>
>> Best regards from Paris,
>> Eric Chatonet.
>> ----------------------------------------------------------------
>> http://www.sosmartsoftware.com/
>> eric.chatonet at sosmartsoftware.com/
>> ----------------------------------------------------------------
>>
>>
>> _______________________________________________
>> 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
>
> _______________________________________________
> 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




More information about the use-livecode mailing list