2022-03-06 01:34 PM
Hello.
I am in need of inputting large strings of text (larger than the width of the screen) using keyboard. I have managed to get a working keyboard, but after increasing the buffer size, the text is being cut off after it leaves the widget area.
I want to be able to scroll the written text left and right, or maybe even up and down. This would require me to somehow get a Scrollable Container as a parent for the text area, or rather the Rect textAreaPosition (which is part of Layout structure), which the text is being drawn on.
I have managed to increase the size of drawn text dynamically by calling setLayout(&layout) after changing the size of textAreaPosition, which means that Scrollable Container could work (although I wonder how will calling this method so fast impact the performance). The question is how to add Scrollable Container as a parent of Rect textAreaPosition, without changing the provided Keyboard widget code? Is it doable? Maybe there is an easy way of doing what I want? Any help appreciated.
Solved! Go to Solution.
2022-03-07 03:34 AM
Hello GHell.1,
The example we provide in TouchGFX Designer is quite old. We have planned to recode it using the widgets so that users can easily modify things within TouchGFX Designer.
To answer your question, no it's not possible without changing the code, and yes it's doable. My suggestion to you would be to try to instance a scrollable container and add your text area to it like this
touchgfx::ScrollableContainer myScrollableContainer;
touchgfx::TextArea myTextArea;
myScrollableContainer.add(myTextArea);
then you can play with ScrollableContainer API :)
myScrollableContainer.enableHorizontalScroll(true);
/Osman
2022-03-07 03:34 AM
Hello GHell.1,
The example we provide in TouchGFX Designer is quite old. We have planned to recode it using the widgets so that users can easily modify things within TouchGFX Designer.
To answer your question, no it's not possible without changing the code, and yes it's doable. My suggestion to you would be to try to instance a scrollable container and add your text area to it like this
touchgfx::ScrollableContainer myScrollableContainer;
touchgfx::TextArea myTextArea;
myScrollableContainer.add(myTextArea);
then you can play with ScrollableContainer API :)
myScrollableContainer.enableHorizontalScroll(true);
/Osman
2022-03-08 12:20 AM
Thank you for response!
The solution turned out to be much simpler than I had originally thought...
I don't know why it didn't cross my mind earlier.
Anyway, I managed to make this work as you suggested.
I extended the CustomKeyboard class with a scrollable container, a text area to put my new scrollable text into, and an image to hide the originally displayed text.
2022-03-08 12:27 AM
Great job ! :)
/Osman
2022-08-25 11:04 AM