Why am I receiving error when using uifigure?
64 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Walter Roberson
2021 年 10 月 4 日
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.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Develop uifigure-Based Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!