How to reorder the List box items in created dialogue window?

I have create two apps. 1.GUI
2. Listboxedit
From GUI button click, it will open a new window with the Listbox data( it will open 2nd app ListBox edit). Till now Its working good.
For your reference I have enclosed the ListBox edit. kindly suggest a way for this?

 Réponse acceptée

Simon Chan
Simon Chan le 5 Juil 2022
Attached code for a listbox with move up button callback.
If this is what you need, you may also implement the move down button callbcak in a similar way.

5 commentaires

I think it does.
Attach is the result after I select SAS program 2 and hit the button.
Or may be I mis-understand something.
ok, I understand.
Add one extra line on the attached code.
I think I might make a mistake if the user select multiple items and they are not in consecutive positions. Do you want each highlighted items to move up by one step only?
That means if the highlighted items are 2 an 4 in the original list, the result should showing [2 1 4 3 5 6 7 8]?
When you allow user to do multiple select on the Listbox, there are numerous combination and you have to decide what will be your expected outcome.
Attached are the codes for multiple selection off only.
If you would like to use the codes given to you as a reference. You need to set ItemsData as the following when you define the uilistbox.
lbox = uilistbox(uif,'Position',[125 50 150 300],...
'Items', compose('SAS Program %d',1:7),'ItemsData',1:7,'Multiselect','off');

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Function Creation dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by