Rotated text example doesn't work
Posted: Thu Oct 19, 2017 4:46 pm
Hi,
I found this example on livecode site:
But I get this:
What's wrong?
I found this example on livecode site:
Code: Select all
widget community.livecode.myname.rotatedtext
use com.livecode.canvas
use com.livecode.widget
use com.livecode.engine
use com.livecode.library.widgetutils
metadata title is "Rotated text example"
metadata author is "myName mySurname"
metadata version is "1.0.2"
variable mRotation as Number
property "rotation" get mRotation set setRotation
metadata widgetTheme.editor is "com.livecode.pi.integer "
public handler SetRotation(in pRotation as Number) returns nothing
put pRotation into mRotation
redraw all
end handler
public handler OnPaint()
variable tText as String
variable tHeight as Number
variable tWidth as Number
variable tRectangle as Rectangle
variable tPath as Path
put my width into tWidth
put my height into tHeight
put "Hello world!" into tText
rotate this canvas by mRotation
put rectangle path of rectangle [0,0,tWidth,tHeight] into tPath
rotate tPath by (-1 * mRotation)
put the bounding box of tPath into tRectangle
fill text tText at center of tRectangle on this canvas
end handler
end widget