TitleInfoο
Overviewο
The TitleInfo widget is a custom TouchGFX container that displays a title text with an optional value below it, accompanied by a horizontal line for visual separation. It provides flexibility in layout with options for short or long lines.
Purposeο
This widget is designed to display informational content with a clear title and optional associated value, making it ideal for settings screens, data displays, or any UI where labeled information needs to be presented in a structured format. The optional value feature allows for dynamic content display, while the line length option adapts to different screen widths.
Componentsο
The widget consists of the following visual elements:
Title Text (title): Displays the main title text
Value Text (value): Optional secondary text displayed below the title (can be hidden)
Long Line (line): Horizontal line for full-width separation
Short Line (lineShort): Shorter horizontal line for compact layouts
Functionalityο
Text Setting Methodsο
setTitle(TypedTextId msgId): Sets the title text using a TouchGFX TypedText resource ID for localization supportsetValue(touchgfx::Unicode::UnicodeChar *msg): Sets the value text directly from a Unicode character array; passnullptrto hide the valuesetShortLine(bool shortLine): Toggles between long line (false) and short line (true) for layout flexibility
Usage in TouchGFX Designerο
Import the Custom Container Package:
Open TouchGFX Designer
Go to
Custom ContainersβImportSelect the TitleInfo package file (manifest.xml)
Add to Screen:
Drag the TitleInfo custom container from the Custom Containers panel onto your screen
Position as needed for information display
Configure Properties:
The widget has no configurable properties in Designer beyond standard container properties
All text content and line style are controlled programmatically
Usage in C++ Codeο
Include the Header:
#include <gui/containers/TitleInfo.hpp>
Declare in View: In your View class (e.g.,
MainView.hpp):TitleInfo titleInfoWidget;
Initialize in Constructor/Setup:
add(titleInfoWidget); titleInfoWidget.setPosition(x, y, width, height);
Set Content:
// Set title using TypedText resource titleInfoWidget.setTitle(T_MY_TITLE); // Set value (optional) titleInfoWidget.setValue(myValueString); // Or hide value titleInfoWidget.setValue(nullptr); // Set line style titleInfoWidget.setShortLine(true); // Use short line
Example Integration:
void MainView::updateInfoDisplay(const char* titleId, const char* value) { titleInfoWidget.setTitle(static_cast<TypedTextId>(titleId)); titleInfoWidget.setValue(reinterpret_cast<touchgfx::Unicode::UnicodeChar*>(const_cast<char*>(value))); titleInfoWidget.invalidate(); }
Files Includedο
manifest.xml: Package manifest with TouchGFX 4.26.0+ requirementcontent/CustomContainerExport.touchgfx: Designer export definitioncontent/CustomContainerManifest.xml: Container manifestcontent/texts.xml: Text databasefiles/gui/include/gui/containers/TitleInfo.hpp: Header filefiles/gui/src/containers/TitleInfo.cpp: Implementation filefiles/assets/fonts/: Font files (Poppins variants) for consistent typography