2020-07-28 07:26 AM
When the designer generates the code for a screen (file "XXXViewBase.cpp") containing a widget with a wildcard, it generates code like this:
txtCount.setPosition(301, 94, 152, 89);
txtCount.setColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
txtCount.setLinespacing(0);
Unicode::snprintf(txtCountBuffer, TXTCOUNT_SIZE, "%s", touchgfx::TypedText(T_SINGLEUSEID1).getText());
txtCount.setWildcard(txtCountBuffer);
txtCount.setTypedText(touchgfx::TypedText(T_COUNT));
where the use of Unicode::snprintf is unqualified.
It should be touchgfx::Unicode::snprintf, since the file itself doesn't declare "using namespace touchgfx".
The code still compiles just because it implicitly relies on a "using namespace touchgfx" being imported from the auto-generated "XXXPresenter.hpp" (which is included by XXXViewBase.hpp".
The presenter is indeed generated with that statement, but it's editable by the user, and it's bad practice to place a "using namespace" in a header file because it can pollute a lot of other files.
If I remove that line in XXXPresenter.hpp, the compilation of XXXViewBase.cpp fails indeed.
So, the designer should not emit any "using namespace touchgfx" in any auto-generated file, and properly qualify names like the above "Unicode::snprintf".
Solved! Go to Solution.
2020-07-29 01:29 AM
Hello,
Thank you very much for the feedback. We will try to fix this in a later release.
/Alexandre
2020-07-29 01:29 AM
Hello,
Thank you very much for the feedback. We will try to fix this in a later release.
/Alexandre