From 2014 to 2015 Matlab Versions I am now unable to display my annotation textbox in a uipanel. How can I display it on top of the uipanel?

I used an annotation textbox which was displayed in a uipanel in version 2014 now in 2015 it can not be displayed in the uipanel. Is there a way of getting round this? I am also using a textbox becuase I need to display the text in a particular format(underscores). Using uicontrol you are unable to do this. Also the annotation textbox you are unable to specify Parent it is not part of the properties list.

 Respuesta aceptada

It sounds like it's probably this issue.
In earlier releases of MATLAB, the panel didn't really honor stacking/containment correctly because it was drawn into the wrong graphics layer. That was fixed in R2014b. You now need to parent things to the panel if you don't want them to be obscured by the panel.
Consider this example:
p = uipanel('Position',[.25 .25 .5 .5])
a1 = annotation(p,'textbox');
a1.String = {'This text string','is inside the panel'};
a1.HorizontalAlignment = 'center';
a1.Position = [.5 .3 .7 .2];
a2 = annotation(gcf,'textbox');
a2.String = {'This text string','is outside of','the panel'};
a2.HorizontalAlignment = 'center';
a2.Position = [.3 .7 .5 .2];

2 comentarios

Great thank you this works fine. In Matlab help it does not specify how you the parent for the annotation textbox or for any annotation should be written writing 'Parent', p does not work. Cheers. Ranjit
Yeah, the help could be clearer. If you do 'doc annotation' instead of 'help annotation', you'll get a bit more detail about the 1st arg, but even that doesn't have a good example.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Preguntada:

el 11 de Ag. de 2015

Comentada:

el 11 de Ag. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by