Is it possible to know when text goes to next line?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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?
- Labels:
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-10-31 2: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
ST Software Developer | TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-11-07 3: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.
