2022-10-25 10:12 PM
I'm using this function:
And I want to know when text line goes to next line. I want to get index or something when goes to second line. Is it possible?
2022-10-31 02:06 AM
Hello @heyo ,
I don't think that this kind of function exists natively in TouchGFX's API.
But you could try to implement it yourself with the getTextWidth() method which will enable you to know the width of the line in pixels. Then you could compare it with the TextArea's width, using the getWidth() function inherited from the Drawable class.
Otherwise, you could also try with the getStringWidth() method from the Font class.
I'm not sure which is the more efficient or clean way to do what you want, you might have to investigate a little in the API and choose what is the more convenient for you.
Hope I helped you,
/Yoann
2022-11-07 03:45 AM
getTextWidth() method finds widest line if it is multi-lined text. For example I have multi-line text and click on second line I want to know first lines width. I'm trying to implement that I can edit text in text area.