GUIDE: rounded vs square button corners
10 views (last 30 days)
Show older comments
I am working on a decent sized existing Matlab program with a GUIDE built user interface.
About half the buttons have square edges and half have rounded edges and for the life of me I can't figure out what is the difference or how to specify either format.
I really don't care which one but I'd like to have them consistent.
Here is a sample as far as I can tell from the property inspector they are both the same
Thanks, Joe
5 Comments
Jiro Doke
on 23 Feb 2012
Jette,
I believe each system has its own default background color that is stored internally and may be different. If at some point, you changed the background color, those will be stored in the .fig file, but if you kept some buttons untouched, they will use the system's default background color. Perhaps that's why you see different colors.
If that's the case, try going into each button and manually setting the background color to the same color.
Answers (3)
Vlad Atanasiu
on 3 May 2015
Edited: Vlad Atanasiu
on 3 May 2015
The shape of button corners changes also when creating the controls programmatically. As you can see from the following image (Matlab R2014b Mac)...
the change occurs between 22 and 23 pixels. The change affects both the corner shape, the entire border shape, as well as the size of the button.
---
CODE FOR TESTING THE SHAPE OF BUTTON CORNERS
---
hMainFigure = figure(...
'Name','Matlab 2014b',...
'NumberTitle','off',...
'Units','pixels',...
'MenuBar','none',...
'Toolbar','none',...
'Position',[0 0 250 60],...
'Visible','on');
hTXT = uicontrol(...
'Style','text',...
'String','Square vs rounded corners',...
'HorizontalAlignment','left',...
'Units','pixels',...
'Position',[10 35 200 20]);
hPB1 = uicontrol(...
'Style','pushbutton',...
'String','10 px',...
'Units','pixels',...
'Position',[10 10 50 10]);
hPB2 = uicontrol(...
'Style','pushbutton',...
'String','22 px',...
'Units','pixels',...
'Position',[70 10 50 22]);
hPB3 = uicontrol(...
'Style','pushbutton',...
'String','23 px',...
'Units','pixels',...
'Position',[130 10 50 23]);
hPB4 = uicontrol(...
'Style','pushbutton',...
'String','40 px',...
'Units','pixels',...
'Position',[190 10 50 40]);
0 Comments
Image Analyst
on 17 Feb 2012
All mine are the same shape. There is only one type of button available to place in GUIDE, unless you used the custom ActiveX capability to place a third party button. Sometimes the buttons look a little sharper at the corners depending on the background color. If it's not white, for example it's dark gray, you may see a white rectangle behind the buttons with sharp corners. And the button also looks a little different if you just clicked on it and so it "has focus" which means that the dotted line is running around the perimeter of the button, or if you clicked on it in GUIDE so that it has the black handles at the edges and corners. Was your picture an actual screenshot of your app?
3 Comments
Jiro Doke
on 18 Feb 2012
I'm not sure I understand. Are you saying the round-vs-square behavior only shows up in GUIDE, but when you run it, it looks fine? So it's not really an issue for using it?
Also, how are you setting the background colors? Are you doing it in GUIDE (from their properties) or in code (in Open functions, etc)?
There's a known issue in Windows where the button looks different depending on whether the background color is using the default color or non-default color. Since WinXP, the system button (rounded button) didn't allow for a non-default background color, but we saw a need for people to change background colors so we provided it with a side-effect of changing the button look.
When I heard you say something about background colors, I thought that would be the case. I was told that this issue shows up on Windows only, so I wasn't sure why you were seeing it on the Mac. Also, if you manually set all buttons to have the same background color, they should have the same look. The fact that the running app looks the same made me think that maybe you were setting the background color in code during start up.
Jeff
on 1 May 2015
In my setup the rounded vs square look depends on the size of the buttons. Small buttons are square, large are rounded. For example, setting the height to 1.5 makes it square, but 2 makes it rounded. For sizes in between, there is some hysteresis.
I'm using Mac OS 10.9.5, Matlab R2014b.
2 Comments
Greig
on 2 May 2015
I have the experience using GUIDE on Mac with 2014a.
Small buttons are square and large buttons have rounded edges. However, if I change the background color of a large rounded edge button, it becomes square.
I find GUIDE is really quirky and not always that convenient to work with. Next time round, I will try it all programmatically.
Jan
on 3 May 2015
GUIDE does not save the shapes of the buttons, but the .fig files are actually .mat files with anotehr file extension. You can check the contents of the .fig file by using load and you will see, that it contains only the parameters of the uicontrols. Therefore it is easy to convert the .fig file created by GUIDE to an M-file, which creates exactly the same figure, see e.g. FEX: guidegetter
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!