Updating Pop-up Menu with data from a Listbox in a GUI
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone,
I'm working on a GUI that can show and color several lines in sincal. I didn't write the code myself. The GUI could only show and color one line and I'm trying to change that, so that it can show multiple lines. I replaced one pop-up menu with a listbox and now I'm trying to adjust the code so that whenever you select multiple entries in the listbox another pop-up menu, that lists the beginning- and endpoints of the lines, is updated with the selection of the listbox (for example you select '3' in the listbox, it shows '45' and '66' beneath). My problem is that the code was written for only one selection and i don't know how to change it for multiple selections, so that if you select '3' and '5' in the box it will write '45', '66', '98' and '34' in the menu (numbers are random). I tried several possibilities with for-loops but it didn't work. The main problem is that if you select two or more entries you get a 1x2+ double, while the GUI can only handle 1x1 at the moment.
Here is the code I need to change:
for i=1:size(islistboxNr,2)
if isZoneType == 1
set(handles.listbox1,'Value',islistboxNr);
if ~isempty(handles.ZoneElementProtNameUnder{islistboxNr(1,i)})
set(handles.protUnder,'String',handles.ZoneElementProtNameUnder{islistboxNr(1,i)});
else
set(handles.protUnder,'String','No Data');
end
I added the for loop at the beginning to prevent an error message showing up. 'islistboxNr' is the double the GUI gets from the listbox selection. The listbox is called 'listbox1'. 'protUnder' is the underfunction, which pop-up menu needs to be updated.
I would be very thankful for any help or ideas I can get! If you need more code or information, just tell me. A completely new code would also help me, perhaps i can integrate it in the GUI.
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!