2021-03-01 06:28 AM
I have a variable declare in protected area of the Screen1ViewBase Class: "touchgfx::IconButtonStyle< touchgfx::ClickButtonTrigger > BlinkyAlertIcon;"
and I want to use this variable in Screen1View which is publicly derived from Screen1ViewBase. I receive "was not declared in this scope" error. I'm using STM32CubeIDE Version 1.5.1 and ToughGFX Version 4.16. Looks like a noob problem I'm I missing any include paths? Or does anyone solved this problem? The files are generated by TouchGFX Designer
Solved! Go to Solution.
2021-03-03 06:58 AM
Thank You all, the problem was very silly because I didn't program in C++ for 10 years or so, and I made a stupid mistake my function definition in cpp file was missing the Class Name and :: before the function name, and of course that the variable was out of scope because my function was declared outside the class.
I'm sorry for wasting your time.
Problem Solved!
Regards,
Claudiu
2021-03-01 08:54 AM
The reason why this happens to me sometimes is because the variable i am trying to screen is declared as volatile inside some function, maybe try to declare your variable as global as you can and debug from there? .......or pause your debugger right when the class is created to check if it shows.
2021-03-01 09:42 AM
ViewBase is generated and overwrited on every touch regenerate code, how you enter your variable in base ???
2021-03-02 12:57 AM
Hello, yes I know that, I didn't write my self variables in ViewBase they were generated by the TouchGFX Designer.
This one, for example: touchgfx::IconButtonStyle< touchgfx::ClickButtonTrigger > BlinkyAlertIcon; is an IconButton. The problem is that I can't used it in ScreenView. Is not reconized by the IDE and if I compile I get "BlinkyAlertIcon" was not declared in this scope. And this is happening with all the Buttons, Labels etc.
I know that in the ViewBase Class those variables are in the protected area but ScreenView is inherited from ViewBase. So I don't understand very well the error.
Claudiu
2021-03-02 01:33 AM
Hello CStir.1,
It 's true it's very strange and I actually cannot reproduce it. Everything generated by Designer is supposed to be compiled correctly and accessible by the child class.
Make sure your ViewBase is correctly included in your View.
One suggestion would be to create a new UI from zero and simply insert your Flex button and see if it happens again.
Lastly, maybe try to reinstall TouchGFX.
/Alexandre
2021-03-02 08:56 AM
Maybe you need simply refresh project after generate new objects in touchgfx. When you plan use show methods build before write new code...
2021-03-03 06:58 AM
Thank You all, the problem was very silly because I didn't program in C++ for 10 years or so, and I made a stupid mistake my function definition in cpp file was missing the Class Name and :: before the function name, and of course that the variable was out of scope because my function was declared outside the class.
I'm sorry for wasting your time.
Problem Solved!
Regards,
Claudiu