cancel
Showing results for 
Search instead for 
Did you mean: 

How do you initialize items in ScrollWheel?

KFrey.1
Associate II

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

3 REPLIES 3
MM..1
Chief III

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.

...

KFrey.1
Associate II

0693W000006G0vrQAC.pngThank 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.

MM..1
Chief III

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...