Multiple Popup menus in a GUI

6 views (last 30 days)
Santosh
Santosh on 22 Apr 2013
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

Accepted Answer

Walter Roberson
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)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!