cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX: Backend communication to custom container text area (wildcard)

H S
Associate III

Hello to everyone,

I was able to add a backend communication from a screen to other FreeRTOS task with a queue message and now I try the other way from the other task to the screen/view.

I add all the parts from the TGFX support site backend-communication to the model and so on, but I'm not able to access to this specific text area (wildcard) because it's a "protected member" of the custom container class.

Maybe it's just a easy problem but because of my poor C++ knowledge I don't find a solution for this problem.

How I get access to a protected custom container member (text area) which is placed on a screen?

Maybe someone can help me with some hints or code snippets.

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
TDahl
Associate II

Hi,

Make a public setTemp function in your sliderContainer

  1. void sliderContainer::setTemp(int newTemperature)
  2. {
  3. // error: 'backendValBuffer' ... is a protected member of 'sliderContainerBase'
  4.  
  5. Unicode::snprintf(backendValBuffer, BACKENDVAL_SIZE, "%d", newTemperature);
  6. textArea1.invalidate();
  7. }

Change the setTemp function in your main screen.

  1. void mainScreenView::setTemp(int newTemperature)
  2. {
  3. // error: 'backendValBuffer' ... is a protected member of 'sliderContainerBase'
  4.  
  5. sliderContainer1.setTemp(newTemperature);
  6. }

/Thomas

View solution in original post

12 REPLIES 12
Martin KJELDSEN
Chief III

How are you accessing the text area? Can you show some code? You could simply add a function in your custom container class that sets the value of the text area.

/Martin

H S
Associate III

Hi Martin,

thanks for your fast response.

I created now a new TGFX project with the STM32F769I Disco with just this backend communication. If you want I can also upload the whole folder.

The problems are in the mainscreenview.cpp -> line 25+26 and in the mainScreenPresenter.hpp -> line 34 (I forget to mention this yesterday).

I add the error message in a comment nearby.

Martin KJELDSEN
Chief III

Hi @H S​ 

Thanks for the update. Crunching **** ** release 4.14.0 at the moment so i can't spare the time to look at projects. I'll try to get back to you asap :)

/Martin

TDahl
Associate II

Hi,

Make a public setTemp function in your sliderContainer

  1. void sliderContainer::setTemp(int newTemperature)
  2. {
  3. // error: 'backendValBuffer' ... is a protected member of 'sliderContainerBase'
  4.  
  5. Unicode::snprintf(backendValBuffer, BACKENDVAL_SIZE, "%d", newTemperature);
  6. textArea1.invalidate();
  7. }

Change the setTemp function in your main screen.

  1. void mainScreenView::setTemp(int newTemperature)
  2. {
  3. // error: 'backendValBuffer' ... is a protected member of 'sliderContainerBase'
  4.  
  5. sliderContainer1.setTemp(newTemperature);
  6. }

/Thomas

H S
Associate III

Hi TDahl,

thanks for your answer. It sounds afterwards so easy but I think to complicated...

Can you maybe help me also with the second problem with the presenter?

What do I have do insert here instead of 'view' because it doesn't work (see the error message at the right).

Do I also need a setTemp function in the presenter?

Excuse me for my stupid questions but I need just one working example to understand it.

No problem Martin, I know you are very busy.

You and the other guys from TGFX do a great job!

Thanks for this! :thumbs_up:

Thanks! That means a lot to us :) I'm not sure why the forum sensored me in that last post, or even what i wrote, haha.

TDahl
Associate II

Looks right to me. Is the error in the presenter not caused be the access error in the view? When you have corrected the view, will the error in presenter not disappear?

H S
Associate III

The first error with the "protected member" is fixed now but the second error from my post above is sadly still present.

The point between "view" and "setTemp" is marked red for this error.