Placing UIPanel on Figure in OpeningFcn

1 Ansicht (letzte 30 Tage)
Michael Critchfield
Michael Critchfield am 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 Kommentar
Adam
Adam am 2 Jun. 2017
Bearbeitet: Adam am 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 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?
  1 Kommentar
Michael Critchfield
Michael Critchfield am 2 Jun. 2017
Thanks for that Jan Simon! I don't know what I have typed before as I thought I had tried this but it works fine now!!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by