249 views
in GUI Development by
Good day to all.

i know that it is possible to control a vertical list with slide touch handler by assigning it to the property SlideHandler.

when trying to assign the same touch handler to other vertical list SlideHandler it returns an error saying it is already in use by other list.

i need to control 4 vertical list with same slide touch handler.

Thank you.

Update: i did find a work around.

i have a scroll bar which controls the 4 vertical list on scroll

VerticalList1.ScrollOffset = -VerticalScrollbar.Position;
VerticalList2.ScrollOffset = -VerticalScrollbar.Position;
VerticalList3.ScrollOffset = -VerticalScrollbar.Position;
VerticalList4.ScrollOffset = -VerticalScrollbar.Position;

i have also connected my slidetouchhandler to vertical list4. onUpdate vertical list 4 does

// The size of the entire scrollable content. (The size of all items within the list)
VerticalScrollbar.ContentArea = VerticalList4.GetItemsArea( 0, VerticalList4.NoOfItems ).h;

// The size of the actually visible portion of the scrollable content. (The size of the list view itself)
VerticalScrollbar.ViewArea = VerticalList4.Bounds.h;

// The position within the list.
VerticalScrollbar.Position = -VerticalList4.ScrollOffset;

signal onScroll;

 

now it looks like it is sliding the other lists as well but in fact it is still using the on scroll command of the scroll bar just updating the positions.

1 Answer

+1 vote
by
 
Best answer

Hello,

your approach sounds reasonable. In practice, it will work as long as all 4 lists have equal size, the same number of entries and the list scroll synchronously.

Alternative approach would be to implement the OnStart and OnSlide slot methods for the Slide Touch Handler instead of connecting the handler to one of the list. In the OnSlide method you would then adjust the ScrollOffset of all 4 lists. In the method OnStart you calculate the slide range and initialize accordingly the Slide Touch Handler's properties MinOffset, MaxOffset and Offset. See also Configure the slide range.

Completely another approach: use one list instead of four. From your description I have understood that all 4 lists are 'synchronised'. They display in fact a single row composed of 4 columns. You could design a list item component displaying such 4 columns and use single list with such item. See also: Specify the class of the items within the list. See also the example in the section Scroll the list items. In this example you see that each item displays two columns: song title and duration:

Similarly, you can design an item with 4 columns and display it within a single list. Then you can connect the Slide Touch Handler with this unique list without additional OnUpdate etc. methods.

I hope it helps you further.

Best regards

Paul Banach

by
Thank you very much for the response. As you mentioned my list are always at equal size so my approach is working but for future reference i will keep these in mind.
In five minutes i will be posting another question see you there :D

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...