uiparent in Matlab 2013b
2 次查看(过去 30 天)
显示 更早的评论
Good day everyone.
I have a question about syntax of a "uipanel". In documentation of my 2013b version I see the following:
Section "Description"
p = uipanel( parent ,Name,Value,...) creates a uipanel with a specific parent and one or more uipanel properties.
And in the "Example":
h = figure; hp = uipanel('Title','Main Panel','FontSize',12,... 'BackgroundColor','white',... 'Position',[.25 .1 .67 .67]);
hsp = uipanel( 'Parent',hp ,'Title','Subpanel','FontSize',12,... 'Position',[.4 .1 .5 .5]);
Does *parent* in Description really mean *'Parent',hp* or I can write just *hp* as a *parent*?
0 个评论
回答(2 个)
Giorgos Papakonstantinou
2015-3-5
These are value/pair arguments. That means you have to write explicitly:
hsp = uipanel('Parent', hp)
Adam
2015-3-5
Matlab functions usually have numerous allowed calling syntaxes. In some cases if you use 'Name', 'Value' pairs for any of the arguments you must do so for all the arguments.
However, in other cases this is not necessary.
p = uipanel
p = uipanel(Name,Value,...)
p = uipanel(parent)
p = uipanel(parent,Name,Value,...)
are the allowed calling syntaxes (in Matlab R2014b - I assume it hasn't changed since R2013b) for a uipanel.
As you can see, parent is the one argument that is different from all the rest and can be passed in without the 'Parent' name field if you so wish. So where parent is concerned:
hsp = uipanel( 'Parent',hp ,'Title','Subpanel','FontSize',12,... 'Position',[.4 .1 .5 .5]);
and
hsp = uipanel( hp ,'Title','Subpanel','FontSize',12,... 'Position',[.4 .1 .5 .5]);
should be exactly equivalent.
Note though that every other argument passed to uipanel must be in the form of 'Name', 'Value' pairs.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dialog Boxes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!