App Designer Image Properties

2 次查看(过去 30 天)
Is there a way to hide all or several images at the same time?
I am writing code to hide/show certain images of a map based on user selection. Is there a more efficient way to do this? My current solution is writing several separate app.mapname.visible = 'off' lines for each image. There will be likely 100s of images used.
% Value changed function: ChooseBayDropDown
function ChooseBayDropDownValueChanged(app, event)
value = app.ChooseBayDropDown.Value;
switch value
case 'Bay 1 - Receiving'
app.bay1_map.Visible = 'on';
app.blank_map.Visible = 'off';
app.bay2_map.Visible = 'off';
app.bay3_map.Visible = 'off';
app.bay4_map.Visible = 'off';
case 'Bay 2 - Heat Room'
app.bay2_map.Visible = 'on';
app.blank_map.Visible = 'off';
app.bay1_map.Visible = 'off';
app.bay3_map.Visible = 'off';
app.bay4_map.Visible = 'off';
case 'Bay 3 - A-Plant'
app.bay3_map.Visible = 'on';
app.blank_map.Visible = 'off';
app.bay2_map.Visible = 'off';
app.bay3_map.Visible = 'off';
app.bay4_map.Visible = 'off';
case 'Bay 4 - Hot Cast'
app.bay4_map.Visible = 'on';
app.blank_map.Visible = 'off';
app.bay1_map.Visible = 'off';
app.bay2_map.Visible = 'off';
app.bay3_map.Visible = 'off';
end
Thanks!

采纳的回答

Kevin Holly
Kevin Holly 2023-7-5
You can use findall to get a handle of all the uiimages.
handle = findall(app.UIFigure,'Type','uiimage');
for ii = 1:length(handle)
handle(ii).Visible = "off";
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by