622 views
in GUI Development by

Hi, I have a vertical list in my GUI development, where the list items are created and added to the list dynamically.  Each time I add a new item to the list, the new item goes to the bottom of the list (below all existing list items).  Is it possible for the new item to be added to the top of the list and for all existing items to move down (which is the reverse of the current list set up)?

1 Answer

0 votes
by

Hello Jonathan,

the Vertical List does not manage the storage of the items. It is just a view. As such you have to take care of the item contents. In the simplest case you can manage the item contents within an array. More sophisticated is to use a data base. If you add/remove items from the storage you have to force the list to refresh its apperance. Accordingly the just added items will appear/disappear (also on top) within the list.

Please see following articles:

Implement the OnLoadItem slot method to load the items

Force the list to reload items

Access list items and views

Best regards

Paul Banach

by
Hello Paul,

Thanks very much for your answer.  Actually, for information, I found the answer to my problem.  In my case, the data store for the vertical list is based on a linked (or chained) list (since the number of records in the list can be changed dynamically when new records are created or records are deleted).  The records in the linked list exactly reflect the items shown in the vertical list.  Originally, I was putting the latest records at the tail of the linked list, but now I am placing the latest records at the head of the linked list.  Now, when the vertical list is reloaded, the newest item is always shown on the top (and all the older items scroll down below) which is what I wanted to see.

Embedded Wizard Website | Privacy Policy | Imprint

...