Rotate fields/buttons? (using snapShot)

David Kwinter david at kwinter.ca
Sun May 18 15:08:01 EDT 2003


On 5/18/03 6:43 AM, "T. R. Ponn" <alptex2 at orwell.net> wrote:

> Hello!
> 
> Is there a way to rotate fields or buttons?  I have a need for an
> arrangement like this in the app I'm working on...any ideas?  Thanks in
> advance for any light you can shed on this!
> 
> Best Regards,
> 
> Tim Ponn
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution




If your desire to rotate buttons and fields is just for visual pizzazz then
perhaps you could use rev to take a "snapShot" of the control you want, then
rotate it as an image. This script does that, but for a reason I think
inside Rev, any angle mod 90<>0 results in a distorted rotation, someone may
get it to work 100% tho, Make two new buttons, put this in the second one
and click it:


on mouseUp

  put "button "&quote&"New Button 1"&quote into controlToRotate
  put 80 into degrees

  put fakeRotate(controlToRotate,degrees) into nada

end mouseUp


function fakeRotate controlToRotate,degrees
   
  put the rect of controlToRotate into cRect
  put the loc of controlToRotate into cLoc
    
  set itemDelimiter to comma
  put item 1 of the topLeft of this stack into xAddOn
  put item 2 of the topLeft of this stack into yAddOn
   
  split cRect by comma
  add xAddOn to cRect[1]
  add yAddOn to cRect[2]
  add xAddOn to cRect[3]
  add yAddOn to cRect[4]
  combine cRect using comma
   
  import snapShot from rect cRect
  put the number of controls into n
  put the imageData of control n into iData
  put the name of control n into iName
    
   wait 30 ticks                       # Why does the rotation get garbled?
  do("rotate "&iName&" by "&degrees)
   
  set the loc of control n to cLoc
    
end fakeRotate




More information about the use-livecode mailing list