2020-12-16 08:10 AM
Dear STM community and team
In the TouchGFX documentation there is a chapter for ScrollWheel:
https://support.touchgfx.com/docs/development/ui-development/ui-components/containers/scroll-wheel
And there is a UI Template called "Scroll Wheel and List Example"
I try to make a custom wheel for my project. In the TouchGFX designer, I can set the "Number of Items" but cannot configure which items (in my case numbers) are going to be displayed.
In the documentation and the UI Tempalte, there are those functions "scrollWheelUpdateItem" and "scrollWheelUpdateCenterItem". I cannot find the declaration for "item" nor the call Hierarchy of it.
Could tell/show me how I can initialize the elements of a ScrollWheel?
Thank you, KFrey.1
2020-12-16 08:29 AM
As first you need create new custom container, aka one line for you list. This container can be one text or multiple complicated structure.
Then in scrollwhell use this in Item template.
...
2020-12-16 08:49 AM
Thank you for your very fast reply. I created a custom container and in the "Text-line", I used a wildcard instead one text or multiple complicated structure, as you suggested.
I already used this custom contaier as a Item template in scrollwheel widgest as you suggested.
The issue is more, that I cannot/don't know how to initialize these values in the STM32CubeIDE.
2020-12-16 09:05 AM
After you create custom container in size what you need, generate code and in ide open container cpp file.
Here you need create methods for setup all in one line , here only text. I havnt example for text but i use buttons, then
void MenuItem::selit(bool sel)
{
if(sel) buttonWithLabel1.setBitmaps(touchgfx::Bitmap(BITMAP_MENU_SEL_ID), touchgfx::Bitmap(BITMAP_MENU_SEL_ID));
else buttonWithLabel1.setBitmaps(touchgfx::Bitmap(BITMAP_MENU_NOSEL_ID), touchgfx::Bitmap(BITMAP_MENU_SEL_ID));
}
void MenuItem::markit(bool sel)
{
if(sel) buttonWithLabel1.setLabelColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 0));
else buttonWithLabel1.setLabelColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
buttonWithLabel1.invalidate();
}
void MenuItem::setIco(const Bitmap& bmp)
{
image1.setBitmap(bmp);
}
void MenuItem::setLabel(TypedText t)
{
buttonWithLabel1.setLabelText(t);
}
In my examp=le is image1 and buttonWithLabel1 my inner objects in container. You need only one or when you plan change colours maybe two methods.
After this you continue in view cpp file...