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?

2 views (last 30 days)
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.

Accepted Answer

Mike Garrity
Mike Garrity on 11 Aug 2015
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 Comments
Ranjit Kaur
Ranjit Kaur on 11 Aug 2015
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
Mike Garrity
Mike Garrity on 11 Aug 2015
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!