Skip to main content
heyo
Associate III
October 5, 2022
Question

How to make cursor for multi text lines? (keyboard)

  • October 5, 2022
  • 5 replies
  • 4548 views

0693W00000UnPesQAF.png

This topic has been closed for replies.

5 replies

Osman SOYKURT
Technical Moderator
October 11, 2022

Hello heyo,

I'm not sure what you want to do. Can you be a more specific in your question ?

If you just want to add a cursor to your text, I'm going to say to simply use the vertical line symbol ( | ) at the end of you text like this :

0693W00000UnpbpQAB.png0693W00000UnpcJQAR.pngI'm using the keyboard widget shared in this post and I only modified the TextArea to add the vertical bar like this :

0693W00000UnpdvQAB.png/Osman

Osman SOYKURTST Software Developer | TouchGFX
heyo
heyoAuthor
Associate III
October 11, 2022

@Osman SOYKURT​  I want that my cursor position changes when I touch anywhere in the text. If I touch in the middle of the text it appears in the middle in the text and then I can edit text. And I want to ask another question. Is it possible to know a coordinate of writeable text?

Osman SOYKURT
Technical Moderator
October 12, 2022

I saw that @Yoann KLEIN​ was helping you on this post. The provided solution is not working ?

/Osman

Osman SOYKURTST Software Developer | TouchGFX
heyo
heyoAuthor
Associate III
October 12, 2022

Actually I do not try that solution. I did it on my way.

heyo
heyoAuthor
Associate III
October 12, 2022

@Osman SOYKURT​  also I use textArea.setWideTextAction(WIDE_TEXT_WORDWRAP_ELLIPSIS_AFTER_SPACE); function. Is it possible to know when text goes to next line?

Osman SOYKURT
Technical Moderator
October 12, 2022

We don't have a particular trigger for that in our API, but this is easily doable with an handleTickEvent() function combined with a getTextHeight() function. You first get the text heigh of your text when your application starts and then compare the the current height with the original height

Something like this :

getTextHeight

void Screen1View::setupScreen()
{
 originalSize = textArea1.getTextHeight();
}
void Screen1View::handleTickEvent()
{
 currentSize = textArea1.getTextHeight();
 if (currentSize > originalSize)
 { 
 // Added one line
 originalSize = currentSize;
 }
 else if (currentSize < originalSize)
 { 
 // Removed one line
 originalSize = currentSize;
 }
 else if (currentSize == originalSize)
 {
 // still same line number
 }
}

/Osman

Osman SOYKURTST Software Developer | TouchGFX
heyo
heyoAuthor
Associate III
October 12, 2022

@Osman SOYKURT​ This function "textArea1.getHeight() " returns defined textArea1 height, so its always be the same and does not change.

Osman SOYKURT
Technical Moderator
October 12, 2022

heyo,

it's getTextHeight() not getHeight() ;)

/Osman

Osman SOYKURTST Software Developer | TouchGFX
heyo
heyoAuthor
Associate III
October 12, 2022

@Osman SOYKURT​ Thanks.