【发布时间】:2017-05-31 00:05:52
【问题描述】:
焦点切换到其他图形后,如何将焦点设置为uifigure?
对于uicontrol,可以将焦点设置在其子元素之一上。例如:
% create a new uicontrol text label
h = uicontrol('style','text','string','This is my figure');
% create a figure to switch the focus
figure;
% switch back
uicontrol(h)
但是,对于uifigure,采用类似的代码只会创建一个新的uifigure。
一些代码供您尝试:
% create a new uifigure
h = uifigure('Name','This is my figure');
% create a new uilabel as a child of uifigure
lh = uilabel(h)
% create a figure to switch the focus
figure;
% this creates a new uifigure then switch back
uifigure(h)
% this creates an error as the first input argument must be a valid parent for uilabel
uilabel(lh)
感谢任何想法、见解或贡献。
请注意,您的 Matlab 版本至少应为 2016a,因为这是引入 uifigure 的时间。
【问题讨论】:
标签: matlab matlab-app-designer