Quick way to rotate text

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Quick way to rotate text

Post by andyh1234 » Wed Mar 04, 2009 2:29 pm

Hi (again!)

Is there a quick way to rotate text.

Im using import snapshot at the moment to convert the field to a graphic then rotating that and hiding the original field, its pretty clumsy and slow.

Is there an easier way to simply rotate a text field?

Andy

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Mar 04, 2009 2:59 pm

Hi Andy,

using a rotated snapshot is the only way unfortunately!

But that is not really slow here on my MacMini 1.66 Ghz!?
Could you post your script?

Best

Klaus

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Post by andyh1234 » Wed Mar 04, 2009 3:53 pm

Sure, the code im using at the moment is

Code: Select all

   
if there is a image "hchartlabel" then delete image "hchartlabel"
import snapshot from fld "labelHeight"
set the name of the last image to "hchartlabel"
rotate image "hchartlabel" by 90
set the loc of image  "hchartlabel" to 30,260
Seems to be fine on the mac, but takes about a second to pop up in Windows XP SP2. If its the best way its fine, just wanted to check if there was a faster way.

Do you know of any code that lets you add an item to a group?

The new snapshot is being created on the main card, Id prefer it in the group so it disappears with the rest of the group when I set the groups visible to false.

Again, its not a huge deal as I can just put a second line in where I turn the groups visible on and off to set the images visible to the same, but it would be perfect if I could just get it to add to the existing group.

Andy

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Mar 04, 2009 6:35 pm

Hi Andy,

add a "lock screen" and "unlock screen", maybe that will speed up things a bit.

Code: Select all

...
lock screen
import snapshot from fld "labelHeight" 
set the name of the last image to "hchartlabel" 
rotate image "hchartlabel" by 90 
set the loc of image  "hchartlabel" to 30,260 
unlock screen
...
At least worth a try :-)

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Post by andyh1234 » Wed Mar 04, 2009 8:04 pm

That did the trick - thanks!

mroam
Posts: 11
Joined: Tue Nov 27, 2007 8:11 pm
Contact:

rotating image of text

Post by mroam » Wed Mar 04, 2009 9:21 pm

PS: If you want to rotate images at angles other than multiples of 90 degrees AND still keep the ability to rotate them back again without distortion, you may use the "set the angle" command to change its property:

Code: Select all

set the angle of image "textpic" to 45
(quoting from documentation: "To rotate an image in a reversible way, or to do repeated rotations without progressive distortion of the image, set its angle property instead of using the rotate command. Unlike the rotate command, the angle property affects only the screen display of the image, not the actual picture data in it, so setting it repeatedly does not introduce distortion.")

Post Reply