Skip to main content
KFrey.1
Associate II
December 16, 2020
Question

How do you initialize items in ScrollWheel?

  • December 16, 2020
  • 3 replies
  • 1348 views

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

This topic has been closed for replies.

3 replies

MM..1
Super User
December 16, 2020

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
KFrey.1Author
Associate II
December 16, 2020

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
Super User
December 16, 2020

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