how to create Dual listbox which transfers items on selection and button press?
조회 수: 2 (최근 30일)
이전 댓글 표시
So I am trying to create a kind of system where one can be able to transfer items to the other listbox but pressing those buttons. For example this menu in Microsoft words.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/146154/image.png)
And this is my simple GUI I used GUIDE to build
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/146155/image.png)
But now my only problem is how to code each listbox and push button to work together seamlessly.
댓글 수: 0
채택된 답변
sfreeman
2014년 11월 19일
편집: sfreeman
2014년 11월 19일
Fill the callback functions of the pushbuttons.
The code for button left to right will include for example:
cList1 = get(hList1,'String');
nSelection = get(hList1,'Value');
cList2 = get(hList2,'String');
cList2 = [cList2 cList1(nSelection)];
set(hList2,'String',cList2);
I assume, you will add some comfort functionality, like sorting the list, preserve actual selection etc.
Btw - I do not know anybody in large scale GUI generation using GUIDE for final code. IMHO creating the GUI by code gives you a better basis for coding the functionality.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!