LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.
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
But I get this:
Screnshot.png (4.9 KiB) Viewed 9529 times
What's wrong?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
From the screenshot, it looks like the rect of widget is smaller than it should be, so the text is cropped. Try clicking on the rect on Edit mode and then resize it.
Best,
Panos
PS: Hermann has created a pretty rotatingText widget
This is a bug of LCB (linux only), the "orientedText"-widget does also not work correctly on linux.
#20446 (at least related to that bug as it shows the same effect).
In this case the main criterion for not fixing in 8 was (lack of) ease of backporting- unfortunately it would have been a different fix due to the graphics library changes in 9. Also in this case proximity to 9 GM was a factor.