Placing UIPanel on Figure in OpeningFcn

2 visualizaciones (últimos 30 días)
Michael Critchfield
Michael Critchfield el 2 de Jun. de 2017
Comentada: Michael Critchfield el 2 de Jun. de 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 comentario
Adam
Adam el 2 de Jun. de 2017
Editada: Adam el 2 de Jun. de 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.

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 2 de Jun. de 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 comentario
Michael Critchfield
Michael Critchfield el 2 de Jun. de 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!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by