Create dropdown at runtime of guide

5 visualizaciones (últimos 30 días)
Markus Kohler
Markus Kohler el 24 de Feb. de 2021
Hello,
I'm currently creating a GUI (matlab 2017 with guide) and I would like the user to be able to press a button which will add a dropdown menu where he then can select data from. The user shall be able to add as many of these dropdowns as he wants.
My current ide is, create a button with a callback which has runns the following code:
function AddFilterStage1_Callback(hObject, eventdata, handles)
ElementNumber=GetNewDropdownNumber(handles);
handle.(['dropdown',num2str(ElementNumber)])=uidropdown
end
unfortunately this creates the dropdown in a new figure, not in the GUI I'm already running. I read the documentation of uidropdown and it says, that I can do uidropdown(fig) where fig = uifigure('Position', [100 100 300 250]), so naturally I tried uidropdown(handles) which didn't work out as well.
I also tried:
handle.(['dropdown',num2str(ElementNumber)])=handle.(['dropdown',num2str(ElementNumber-1)])
But this would not create a copy of the button instead the Element n and Element n-1 are connected to the same dropdown (so I can manipulate the same dropdown with both Elements in the Class).
Is there a different way to achieve what I want to do or what am I doing wrong?
Thank you in Advance,
Markus

Respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by