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)
Show older comments
Ranjit Kaur
on 11 Aug 2015
Commented: Mike Garrity
on 11 Aug 2015
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.
1 Comment
Walter Roberson
on 11 Aug 2015
annotation(handle,...) creates the annotation in the figure, uipanel, or uitab specified by handle.
Accepted Answer
Mike Garrity
on 11 Aug 2015
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
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.
More Answers (0)
See Also
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!