2022-11-15 03:02 AM
I have a project with a little status bar at top of the screen. I have used the custom container function. Along with some other status icons it shows time via the digital clock widget. This widget needs the include
#include <touchgfx/Color.hpp>
as it is basically a text filed that is manipulated by clock functions. While working on the project it was decided that we remove a former present text are as it was not longer needed. The removal resultet in an error while compiling the project in STM32CubeIDE showing the following error:
Description Resource Path Location Type
'touchgfx::Color' has not been declared infoBarBase.cpp /STM32F429I-DISCO/Application/User/generated line 19 C/C++ Problem
If I add the additional and gui-wise unneeded text area the code will work fine as TouchGFX adds the color.hpp include in the custom container base file. But why does TouchGFX remove the still needed include in the first place? I could just add a hidden text area for it to work but this is no satisfying solution.
2022-11-18 06:49 AM
Hello Loppi,
Did you regenerate your code from TouchGFX Designer before compiling with STM32CubeIDE?
Seems to me that the project isn't cleaned and still has previous generated includes.
/Osman
2022-11-21 12:38 AM
Hi @Osman SOYKURT,
Yes I have generated the code from TouchGFX Designer beforehand. In fact I have tried this multiple times and everytime I deleted the textArea on custom container the said color.hpp include was missing again.
2022-11-29 12:40 AM
Hello,
Did you have a specific scenario to reproduce your issue? Btw, which version of TouchGFX Designer do you use?
/Osman
2022-11-29 12:54 AM
Hi Oskt,
Yes I have a specific scenario where this occurs. It is flighty discribed in my initial question.
I have created a little custom container containing various images for battery, wifi, etc. and the digital clock widget. This custom container is added upon multiple screens. But the issue lies within the code generation of the customContainerBase.cpp. The digitalClock widget is using the setColor function which is included in Color.hpp but adding just the digitalClock widget, touchgfx does not generate this include. The error is reproducable for me. Adding a textArea to the same custom container makes touchgfx generate the necessare color.hpp include. Removal of the textArea will result in a removal of the color.hpp include although the digitalClock widget is stil using it.
generated code WITH textArea:
/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <gui_generated/containers/infoBarBase.hpp>
#include <BitmapDatabase.hpp>
#include <texts/TextKeysAndLanguages.hpp>
#include <touchgfx/Color.hpp>
infoBarBase::infoBarBase()
{
setWidth(320);
setHeight(27);
batteryIcon.setXY(282, 6);
batteryIcon.setBitmap(touchgfx::Bitmap(BITMAP_PBAT4_2_ID));
wifi3.setXY(255, 6);
wifi3.setBitmap(touchgfx::Bitmap(BITMAP_PWLAN2_ID));
digitalClock1.setPosition(6, 1, 76, 23);
digitalClock1.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
digitalClock1.setTypedText(touchgfx::TypedText(T___SINGLEUSE_9WWR));
digitalClock1.displayLeadingZeroForHourIndicator(true);
digitalClock1.setDisplayMode(touchgfx::DigitalClock::DISPLAY_12_HOUR);
digitalClock1.setTime12Hour(10, 22, 22, false);
scalableImage1.setBitmap(touchgfx::Bitmap(BITMAP_NFC_02_ID));
scalableImage1.setPosition(230, 4, 20, 20);
scalableImage1.setScalingAlgorithm(touchgfx::ScalableImage::NEAREST_NEIGHBOR);
textArea1.setXY(0, 0);
textArea1.setVisible(false);
textArea1.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
textArea1.setLinespacing(0);
textArea1.setTypedText(touchgfx::TypedText(T___SINGLEUSE_7CK7));
add(batteryIcon);
add(wifi3);
add(digitalClock1);
add(scalableImage1);
add(textArea1);
touchgfx::Application::getInstance()->registerTimerWidget(this);
}
infoBarBase::~infoBarBase()
{
touchgfx::Application::getInstance()->unregisterTimerWidget(this);
}
void infoBarBase::initialize()
{
}
//Handles tick based events
void infoBarBase::handleTickEvent()
{
//updateDigitalClockFunction
//When every N tick call virtual function
//Call updateDigitalClock
updateDigitalClock();
//updateBatteryWidgetFunction
//When every N tick call virtual function
//Call updateBatteryWidget
updateBatteryWidget();
}
code generation without textArea:
/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <gui_generated/containers/infoBarBase.hpp>
#include <BitmapDatabase.hpp>
#include <texts/TextKeysAndLanguages.hpp>
infoBarBase::infoBarBase()
{
setWidth(320);
setHeight(27);
batteryIcon.setXY(282, 6);
batteryIcon.setBitmap(touchgfx::Bitmap(BITMAP_PBAT4_2_ID));
wifi3.setXY(255, 6);
wifi3.setBitmap(touchgfx::Bitmap(BITMAP_PWLAN2_ID));
digitalClock1.setPosition(6, 1, 76, 23);
digitalClock1.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
digitalClock1.setTypedText(touchgfx::TypedText(T___SINGLEUSE_9WWR));
digitalClock1.displayLeadingZeroForHourIndicator(true);
digitalClock1.setDisplayMode(touchgfx::DigitalClock::DISPLAY_12_HOUR);
digitalClock1.setTime12Hour(10, 22, 22, false);
scalableImage1.setBitmap(touchgfx::Bitmap(BITMAP_NFC_02_ID));
scalableImage1.setPosition(230, 4, 20, 20);
scalableImage1.setScalingAlgorithm(touchgfx::ScalableImage::NEAREST_NEIGHBOR);
add(batteryIcon);
add(wifi3);
add(digitalClock1);
add(scalableImage1);
touchgfx::Application::getInstance()->registerTimerWidget(this);
}
infoBarBase::~infoBarBase()
{
touchgfx::Application::getInstance()->unregisterTimerWidget(this);
}
void infoBarBase::initialize()
{
}
//Handles tick based events
void infoBarBase::handleTickEvent()
{
//updateDigitalClockFunction
//When every N tick call virtual function
//Call updateDigitalClock
updateDigitalClock();
//updateBatteryWidgetFunction
//When every N tick call virtual function
//Call updateBatteryWidget
updateBatteryWidget();
}
I am using TouchGFX 4.20.0.