cancel
Showing results for 
Search instead for 
Did you mean: 

Scrollwheel hides Items above the selected Item when using SelectedItemOffset and CircularMode not enabled

t.decker
Senior II

Im using Scrollwheels on different screens. Wherever I move the selected Item to the middle of the list by increasing the SelectedItemOffset, Items above the selected Item (middle of the list) tend to disappear. As soon as I activate the Circular mode, everything runs fine.

Does anyone else had similiar behaviour? I tried to provoke this with the very similar ScrollWheel/List example, but there it is running fine.

I'm using the current TouchGFX 4.20.

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

Accepted Solutions
t.decker
Senior II

I think I found the solution. I was looking at your code and didn't find anything different compared to mine. But looking at the Designer I noticed that I have set the Number of Items to 1 and you had 16. So I increased the value and now it's working. I thought this value is irrelevant, because the item count will be changed at runtime anyway.

Looking at the changes the code generator makes, this looks like a bug inside the TouchGFX lib when setting the Selected Item Offset to a value where no items exist at the moment of the function call (in the constructor of the parent screen/container):

swOutput.setNumberOfItems(1);
swOutput.setSelectedItemOffset(125);

vs.

swOutput.setNumberOfItems(10);
swOutput.setSelectedItemOffset(125);

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

View solution in original post

6 REPLIES 6
wired
Senior III

I was using the SelectedItemOffset without circular mode on a ScrollWheel, and had no issues. I based my design off the ScrollWheel example. However, I was setting the item offset in Designer, not dynamically. Do you need/have an invalidate() after changing the offset?

t.decker
Senior II

Thanks for your reply. I'm setting the offset also in the Designer, so no need for invalidation.

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

I don't know if this will help, but I'm attaching my example I used as the basis for my actual application. It is based on the TouchGFX-supplied scroll example. In my case, I am dynamically adding items to the list.

t.decker
Senior II

I think I found the solution. I was looking at your code and didn't find anything different compared to mine. But looking at the Designer I noticed that I have set the Number of Items to 1 and you had 16. So I increased the value and now it's working. I thought this value is irrelevant, because the item count will be changed at runtime anyway.

Looking at the changes the code generator makes, this looks like a bug inside the TouchGFX lib when setting the Selected Item Offset to a value where no items exist at the moment of the function call (in the constructor of the parent screen/container):

swOutput.setNumberOfItems(1);
swOutput.setSelectedItemOffset(125);

vs.

swOutput.setNumberOfItems(10);
swOutput.setSelectedItemOffset(125);

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

Glad you got it worked out. Yes, there is weirdness if you exceed the number of items specified in the Designer at runtime. Perhaps there is a static memory allocation for the list based on this number. That is what I assumed when I encountered issues, so I made my Number of Items in the Designer greater than what I would ever need. It would be good if ST gave some input to this, as there is very little information about Number of Items in the documentation.

I was initially working with the Scroll Wheel like you and also had an offset, but since the scroll wheel cannot distinguish between an 'animated to' selection and a 'clicked on' selection (see my post here), I switched to a scroll list. I don't recall if it had the same issues with respect to the number of items.

t.decker
Senior II

Any news here from ST's side?

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