Multiple Popup menus in a GUI
6 views (last 30 days)
Show older comments
Hello,
I am relatively new to MATLAB GUI. I am working on creating a bunch of popup menus for an application.
If I have two popup menus I can easily have tags popupmenu1 and popupmenu2 and access the content of those menus. But, I need more than 20 popupmenus. Is there a way to tag the popup menus using tags like: popupmenu(1), popupmenu(2).... so that I can have an array of popupmenus. Creating an array of popupmenus will make it easy for me to access the contents of that menu
Really Appreciate the help
Thanks, Santosh
0 Comments
Accepted Answer
Walter Roberson
on 22 Apr 2013
A tag is a text string; you can use the string 'popupmenu(1)', but that is just a string and does not signal an array.
If you are trying to use GUIDE then using any character other than A-Z a-z 0-9 or underscore will cause you problems, I believe.
You can store the handles in an array. For example,
for K = 1 : 10
H(K) = uicontrol('Style', 'pop', 'String', {sprintf('#%d', K)}, 'Units', 'norm', 'Position', [rand,rand,0.05,0.05]);
end
and you can stuff that away in "handles" if you are using the handles structure:
handles.popups = H;
guidata(gcf, handles);
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!