Creating an editable rotatable textbox
Andrew Weighill (5123) 13 posts |
My next question…! I’ve learned how to place text in a window using Font_Paint or use an editable text icon, but how would I go about creating a rotatable editable textbox? |
Stuart Swales (8827) 1357 posts |
You can supply a transformation matrix to Font_Paint to rotate the text, and the Swiss army knife Font_ScanString can use the same transformation matrix to help you position your caret (which you’d have to render yourself) given mouse click or index within the string – see https://www.riscosopen.org/wiki/documentation/show/Font_ScanString. For sanity, I’d advise doing everything to do with fonts in millipoints; just convert from OS units for mouse clicks. |
Chris Hall (132) 3554 posts |
Use MakeDraw from !Store PROCmdTextTran(x,y,t$,r) Positions a transformed text object at (x,y) using the current text style The text should not contain any control characters: if it does an error will For example: PROCmdTextTran(100,200, “This text is rotated clockwise by 90 deg”,PI/2) |
Andrew Weighill (5123) 13 posts |
I’ve used Font_ScanString to identify the bounding box of the text, I’m now wondering whether to use Draw_Stroke or PLOT codes to draw the textbox outline. I could do a dotted outline with PLOT code 16, or use Draw_Stroke with dashes to achieve the same thing. PLOT codes are more straightforward, but would Draw_Stroke have some benefits? Anyone got any guidance for me? |