cancel
Showing results for 
Search instead for 
Did you mean: 

Scrollable text

Ricko
Associate III

Hi,

how do you implement a scrollable text box? i.e. a text box where the text is too long to display in the available area so the user needs to scroll down like in a mobile phone?

Is this done fully by TouchGFX or do I need to write a lot of code behind it to do the display and the scrolling?

Thank you 🙂

1 ACCEPTED SOLUTION

Accepted Solutions

My pleasure!

 

1) the scrolling functionality (i.e. the code for the scrolling) is generated by the TouchGFX (or other tool) or if I need to write additional code

TouchGFX Generates codes based on the design you create in Designer.
The generated code can be found in the folder "generated" => "gui_generated". Those files are call xxxxxxxxBase.cpp/hpp, ex: screen1ViewBase.cpp. You should never modify these files as they get regenerated (erasing your changes) every time you click on "Generate code" in Designer.

It also creates a bunch of other files and folders. The one that matter to you are in the folder "gui", ex: screen1View.cpp (which you can modify).

In the example I made (were you able to look at the example I provided, the file with 7z extension?) the whole design inside Designer and did not code a single thing.
However, if you want to fetch the length of the textArea and set the length of the scrollable container accordingly, you would have to write some simple code in screen1View.cpp.

 

2) if, to do the entire scrollable text box with fixed text inside it that can be scrolled - whether like you suggested or any other way - is a few hours job or a week long job. Again this is for someone who has written a lot of C but never used UI or touch displays, let alone TouchGFX.

Well, it depends on you. Personally, it took me a few minutes to make the example I sent you. At the beginning you might not know which widget to use, etc, but it get easy quite fast.

If you are new to TouchGFX, we create a few resources for you :

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

View solution in original post

5 REPLIES 5
GaetanGodart
ST Employee

Hello @Ricko ,

 

I have implemented that by putting the textArea inside a scrollable container.
In the textArea setting, I have to uncheck "Auto-size", set the width.
In the scrollable container, I have to make sure it is big enough to hold the whole textArea (the height).
I have not tried to make TouchGFX calculate that, so I put it by hand.
The height of the scrollable container could probably be set at runtime by using the textArea method "virtual int16_t getTextHeight() const" and the scrollabelContainer method setHeight.

If this answers your question, I invite you to select this comment as "best answer".

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Thank you @GaetanGodart 

not having any experience with TouchGFX, , what I am trying to understand are two points:

 

1) the scrolling functionality (i.e. the code for the scrolling) is generated by the TouchGFX (or other tool) or if I need to write additional code

 

2) if, to do the entire scrollable text box with fixed text inside it that can be scrolled - whether like you suggested or any other way - is a few hours job or a week long job. Again this is for someone who has written a lot of C but never used UI or touch displays, let alone TouchGFX.

 

Thank you as alaways

Ricko

My pleasure!

 

1) the scrolling functionality (i.e. the code for the scrolling) is generated by the TouchGFX (or other tool) or if I need to write additional code

TouchGFX Generates codes based on the design you create in Designer.
The generated code can be found in the folder "generated" => "gui_generated". Those files are call xxxxxxxxBase.cpp/hpp, ex: screen1ViewBase.cpp. You should never modify these files as they get regenerated (erasing your changes) every time you click on "Generate code" in Designer.

It also creates a bunch of other files and folders. The one that matter to you are in the folder "gui", ex: screen1View.cpp (which you can modify).

In the example I made (were you able to look at the example I provided, the file with 7z extension?) the whole design inside Designer and did not code a single thing.
However, if you want to fetch the length of the textArea and set the length of the scrollable container accordingly, you would have to write some simple code in screen1View.cpp.

 

2) if, to do the entire scrollable text box with fixed text inside it that can be scrolled - whether like you suggested or any other way - is a few hours job or a week long job. Again this is for someone who has written a lot of C but never used UI or touch displays, let alone TouchGFX.

Well, it depends on you. Personally, it took me a few minutes to make the example I sent you. At the beginning you might not know which widget to use, etc, but it get easy quite fast.

If you are new to TouchGFX, we create a few resources for you :

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Thank you @GaetanGodart 

My pleasure!

Gaetan Godart
Software engineer at ST (TouchGFX)