Placing UIPanel on Figure in OpeningFcn
2 views (last 30 days)
Show older comments
Michael Critchfield
on 2 Jun 2017
Commented: Michael Critchfield
on 2 Jun 2017
Hello, I am trying to create an uipanel on a figure during the OpeningFcn using the following line:
bp = uipanel('Units','pixels','Position','[8 41 490 500],'Tag','BackgroundPanel','BorderType','none');
The Panel is created but it's placed on the calling figure. I tried several Parent settings but so far haven't come up with something working so the Panel is on the opening figure.
Can anybody help me with this please?
Best regards, Michael
1 Comment
Adam
on 2 Jun 2017
Edited: Adam
on 2 Jun 2017
It would be more useful to show a version with the parent that you tried that didn't work. The above attempt certainly doesn't specify a parent and will end up in the wrong place if you open this figure from another figure.
Trying the obvious parent, as in Jan's answer works fine for me in a figure that is not launched from another, but should equally work fine however it is launched.
Accepted Answer
Jan
on 2 Jun 2017
Inside the OpeningFcn:
bp = uipanel('Units','pixels','Position','[8 41 490 500], ...
'Tag','BackgroundPanel','BorderType','none', ...
'Parent', hObject);
This seems to be the most obvious parent. What did you try?
More Answers (0)
See Also
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!