Matlab App Designer Pop Up Figure
46 views (last 30 days)
Show older comments
Currently I have a GUI edit field named Number of Segments where I can enter a number and a pop up window with tabgroups depending on the value for Number of Segment is inputted. Is there a way to add some sort of callback to the uieditfield of PropogationEdit or LoopsEdit? Also if I have multiple tabs how to differentiate the edit fields for each individual tab? If I can I want to store each tab as an array with the indexes being the edit field then an encompassing array storing each tab's array.
Thank you
Here is the code that I have for reference:
function NumberofsegmentsEditFieldValueChanged(app, event)
value = app.NumberofsegmentsEditField.Value;
app.UIFigure = uifigure("Position",[600 300 400 450]);
TabGroup = uitabgroup(app.UIFigure, "Position",[0 0 400 450]);
nTabs = value;
for i=1:nTabs
tab = uitab(TabGroup,"Title","Segment "+i);
%Propogation
PropogationTxt = uilabel(tab, "Text","Propogation Distance [m]","position",[100 350 150 20]);
PropogationEdit = uieditfield(tab,"numeric","position",[300 350 50 20])
%Loop
LoopTxt = uilabel(tab, "Text","Number of Loops","position",[100 300 150 20]);
LoopsEdit = uieditfield(tab,"numeric","position",[300 300 50 20]);
end
end
0 Comments
Answers (1)
Eric Delgado
on 18 Nov 2022
You can use "Tag" property...
% Tabs creation
UIFigure = uifigure("Position",[600 300 400 450]);
TabGroup = uitabgroup(UIFigure, "Position",[0 0 400 450]);
for i=1:3
tab = uitab(TabGroup,"Title","Segment "+i);
PropogationTxt = uilabel(tab, "Text","Propogation Distance [m]","position",[100 350 150 20]);
PropogationEdit = uieditfield(tab,"numeric","position",[300 350 50 20]);
LoopTxt = uilabel(tab, "Text", "Number of Loops", "position", [100 300 150 20]);
LoopsEdit = uieditfield(tab, "numeric", "position", [300 300 50 20], "Tag", "Segment "+i);
end
% Edit Field search
hObj1 = findall(groot, 'Type', 'uinumericeditfield', 'Tag', 'Segment 1');
hObj2 = findall(groot, 'Type', 'uinumericeditfield', 'Tag', 'Segment 2');
hObj3 = findall(groot, 'Type', 'uinumericeditfield', 'Tag', 'Segment 3');
0 Comments
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!