uipanel border type problem
8 views (last 30 days)
Show older comments
I am designing a GUI where I want to nest 2 or 3 panels in such a way they are perfectly aligned. If I run the following code to nest 100 panels (just an extreme example) inside each other:
a = figure
b=uipanel(a, 'units', 'pixels', 'position', [10, 10, 200, 200]);
for i=1:99
b = uipanel(b, 'units', 'pixels', 'BorderType', 'etchedout','OuterPosition', [1, 1, 200, 200]);
b.Position(1:2) = b.Position(1:2)-b.BorderWidth;
end
I get this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190253/image.jpeg)
I corrected the border width offset, but still the panels are not properly aligned. This problem doesn't happen if I use a border of type 'line'. Is there any way to perfectly align all the nested panels for any border type?
In addition, for a 'BorderWidth' of 1, a border of type 'line' has still a different width than a border of type 'etchedout'. It also should be '0' when border type is 'none', but is still '1'. How to find the true border width?
Regards
5 Comments
Jan
on 2 May 2018
@André: Please post the code, which creates the shown figure and which reproduces the problem. This is more useful than posting some other code, which creates 100 nested panel, which you do not need at all. I'm not sure, which detail the actual problem is.
Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks 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!