Why am I receiving error when using uifigure?
69 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alena Schwartz
el 4 de Oct. de 2021
Comentada: Alena Schwartz
el 4 de Oct. de 2021
I am trying to run a program which uses the uifigure command to create a GUI. My code was running fine yesterday. Today, when I try running the code, I get the following error message:
Error using uilistbox (line 42)
Functionality not supported with figures created with the figure function. For more information, see
Graphics Support in App Designer.
Error in slicingObjectsV01 (line 44)
h.listBox = uilistbox(h.loadPanel);
I cannot figure out how to fix this. I am using the uifigure command so I do not understand why MATLAB thinks that I am using the figure command.
Here is the beginning of my code:
%% GUI
h.slicingObjects = uifigure;
h.slicingObjects.Color = [0.8 0.8 1];
h.slicingObjects.Position = [45 70 1410 900];
h.slicingObjects.Units = 'Pixels';
h.slicingObjects.Resize = 'Off';
h.slicingObjects.Visible = 'off';
h.slicingObjects.Name = 'Slicing Objects';
%% Image Display Plot
h.sliceDisplayBackground = uiaxes(h.slicingObjects,'Units','Pixels');
h.sliceDisplayBackground.XTick = [];
h.sliceDisplayBackground.YTick = [];
h.sliceDisplayBackground.Color = [0 0 0];
h.sliceDisplayBackground.Position = [10 10 880 880];
h.sliceDisplay = uiaxes(h.slicingObjects,'units','pixels');
h.sliceDisplay.XTick = [];
h.sliceDisplay.YTick = [];
h.sliceDisplay.Color = 'black';
h.sliceDisplay.Position = [10 10 880 880];
%% Load Panel
h.loadPanel = uipanel('units','pixels');
h.loadPanel.Title = 'Load';
h.loadPanel.TitlePosition = 'centertop';
h.loadPanel.BackgroundColor = 'white';
h.loadPanel.FontName = 'Century Gothic';
h.loadPanel.FontSize = 20;
h.loadPanel.FontWeight = 'bold';
h.loadPanel.Position = [900 640 500 250];
listBoxItems = {'Series 1','Series 2','Series 3','Series 4'};
% List Box
h.listBox = uilistbox(h.loadPanel);
h.listBox.Items = listBoxItems;
h.listBox.BackgroundColor = 'white';
h.listBox.FontName = 'Century Gothic';
h.listBox.FontSize = 15;
h.listBox.Enable = 'off';
h.listBox.Position = [20 90 460 120];
0 comentarios
Respuesta aceptada
Walter Roberson
el 4 de Oct. de 2021
h.loadPanel = uipanel('units','pixels');
You did not parent that call, so uipanel() is going to look for the current figure using gcf -- which only looks for traditional figures, not for uifigure() . It would not find any current figure so it would create one to be the owner of the uipanel.
You need to pass in the parent of the uipanel to the uipanel() call.
Más respuestas (0)
Ver también
Categorías
Más información sobre Develop uifigure-Based Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!