Matlab App Designer Pop Up Figure

조회 수: 21 (최근 30일)
Kuang-Ting Hsueh
Kuang-Ting Hsueh 2022년 11월 17일
답변: Eric Delgado 2022년 11월 18일
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

답변 (1개)

Eric Delgado
Eric Delgado 2022년 11월 18일
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');

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by