cancel
Showing results for 
Search instead for 
Did you mean: 

Change shape color of active view

joel_
Associate II

Hello.

I am new to TouchGFX and have been learning it over the last few weeks. I am able to generate an application with multiple screens, and swap screen utilizing the TouchGFX designer actions & interactions.

 

I have a screen, called Screen4, that is a testing screen to test out different iconographies:

joel__3-1749568832661.png

Within that Screen4 I have two actions:

joel__4-1749568862802.png

And two interactions:

joel__5-1749568881875.png

The goal of these two actions & interactions is to control the screen from application code, with the goToScreen function being utilized to notify the graphics engine to display Screen4 and the setLevel function to notify the graphics engine to update the color of all the shapes to a passed in value (0-255 on RED only).

 

The goToScreen function works perfectly, and I am able to call it directly from my application code - 

joel__7-1749569086338.png

- and have the screen be displayed.

 

The setLevel command is giving me some trouble though, and here is where I think I am missing a core piece of my understanding of the graphics engine.

The setLevel function is generated by the TouchGFX designer - 

joel__8-1749569177537.png

- as a Screen4ViewBase function, and that forwards the inputted value to function1(), which is a virtual void by default within the Screen4ViewBase class - 

joel__9-1749569216970.png

 

I have overridden that within the user Screen4View class (not the base class) and populated it with what I think is the correct code to change the colors of all the shapes - 

joel__10-1749569349671.png

 

I believe my issue (and misunderstanding) is how I am calling the setLevel function from my application code - 

joel__12-1749569516658.png

- I am able to step through the code and see that the above function does eventually make it to the Screen4View::function1 and run through it properly, but I am not seeing the graphics engine force a re-draw of the invalidated areas. I believe this is because I've instantiated a new instance of the Screen4View that is not tied to the current screen that is being displayed, and so the graphics engine doesn't do anything with my updates. 

 

think the correct process here is something like this:

Call joel__7-1749569086338.png

Then, when wanting to change the shape color, call:

miscChangeLevelCall( uint8_t value :(

-- Get active screen

-- Call 'setLevel' of active screen

 

Questions:

  1. Is the above thought process correct, or have I misunderstood something?
  2. What is the proper way to have the graphics library display a new screen from the application code?
  3. What is the proper way to modify sections of that screen and have the graphics engine only re-render those sections, not the whole screen, from application code?

 

Thanks!

 

 

 

 

 

2 REPLIES 2
LouisB
ST Employee

Hello @joel_ ,

From where do you call miscFunctionCall and miscChangeLevelCall ?

BR,

Louis BOUDO
ST Software Developer | TouchGFX

Hi @LouisB,

The intent is for these functions to be available for the user to call at will. Currently they are setup to be called from a command line for testing purposes.