cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate Items when using Scroll wheel

brymat
Associate II

Setup:

  • TouchGFX v4.23.0
  • STM32H747
  • Scroll wheel with selected item template

 

Issue:

I dynamically set the number of items in the scroll wheel using the function setNumberOfItems() so in the TouchGFX designer I set the Number of Items to 0.  As an example, I am displaying 4 items but have 8 to choose from.  When the scroll wheel is first shown, the first 4 items (index 0 - 3) are rendered correctly.  When I push down, the screen correctly shifts and shows items 1 - 4.  When I push down again, the first item (index 2) is shown in the first, selected position and is shown in the 4 position as well.  

As I continue to navigate down in the list, sometimes there are other duplicates, sometimes the list is correct.

 

Workaround:

I tried a few different things but setting the Number of Items in the designer to 2 (I didn't try any other value) solved the duplicate glitch.

 

So it seems, that having the Number of Items set to 0 is what causes this issue in the first place.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @brymat ,

Sorry for the late response, 
I realized that you need to set the 'Number of Items' in the designer, as large as the number of visible elements in the designer or bigger. So, for instance, in the example that you have provided, you just need to set the number of elements to 5 in the beginning and then change it later. 

The simulation working correctlyThe simulation working correctly

There should a bug that causes this behavior, in other words, there is a dependency on the first call to setNumberOfItems. We will dig into it more, and hopefully fix the issue as soon as possible. But, I hope the current solution can help you progress.

Good luck

Mohammad MORADI
ST Software Developer | TouchGFX

View solution in original post

5 REPLIES 5

Hello @brymat ,

I tried to replicate the issue you mentioned, but I was not successful. Is it possible for you to share a simple project that demonstrate the problem?

Thank you

Mohammad MORADI
ST Software Developer | TouchGFX
brymat
Associate II

Hello,

I have attached a simple example based on the Scroll Wheel example in TouchGFX and targeting the STM32H747I discovery kit.

 

If you switch to the "Scroll Wheel" option in the display, you will see the duplicated values in the list right away.  Scrolling back and forth shows many odd values in the list.  Although the selected value is always correct.

I have also attached a photo as an example.  In the photo, I would have expected to see the values 22, 23, 24, not 22, 22, and 20.

ScrollWheelExampleCropped.jpg

Cheers,
Bryan

urbito
Senior

i have had kind of similar issue in the past when using the "number picker" that has been shared in the past from an STEmployee.

 

Its number picker has two functions:ScrollWheelUpdateCenterItem and ScrollWheelUpdateItem

 

The first is for the "seeing" item and the other is for the not "seeing" items. 

 

I guess you are not updating well the second (or equivalent) part/function. 

t.decker
Senior II

I always set the item count in the TouchGFX Designer to a value higher than the visible item count to cope with this bug you mentioned.

Also, when changing the item count at runtime I always do:

 

 

setNumberOfItems(0);
setNumberOfItems(newValue);

 

 

To handle some update-problems. I don't remember the details anymore.

Edit: This can cause crashes in the Simulator MS Windows application. Please read the solution post of this thread for more details: https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-simulator-assertion-quot-timerwidget-registered-too/td-p/679316

When this account seems to be inactive, try @tdecker2 - ST can't change mail addresses, so I had to create a new account.

Hello @brymat ,

Sorry for the late response, 
I realized that you need to set the 'Number of Items' in the designer, as large as the number of visible elements in the designer or bigger. So, for instance, in the example that you have provided, you just need to set the number of elements to 5 in the beginning and then change it later. 

The simulation working correctlyThe simulation working correctly

There should a bug that causes this behavior, in other words, there is a dependency on the first call to setNumberOfItems. We will dig into it more, and hopefully fix the issue as soon as possible. But, I hope the current solution can help you progress.

Good luck

Mohammad MORADI
ST Software Developer | TouchGFX