MATLAB Answers

GUIDE: rounded vs square button corners

37 views (last 30 days)
Joseph Areeda
Joseph Areeda on 17 Feb 2012
Edited: Vlad Atanasiu on 3 May 2015
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
Joseph Areeda
Joseph Areeda on 23 Feb 2012
I have confirmed that all the buttons are square on Windows 7.
And as stated before the background color is set on ALL the buttons because they seemed to take the background color from the container panel's HIGHLIGHT color.
One more issue I am having with my cross platform validation is button sizes. If text is specified in points and buttons are specified in pixels shouldn't the text fit in the buttons on different systems?

Sign in to comment.

Answers (3)

Vlad Atanasiu
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]);

Image Analyst
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
Joseph Areeda
Joseph Areeda on 23 Feb 2012
Jiro,
The button look the same in GUIDE and the running program. On Macs some are round and some are square.
All have the background colors set because on Linux and Windows the background color seems to come from the highlight color for the panel they are in.
Also on Ubuntu and Scientific Linux (a Fedora derivative) the buttons are square. I have to check Windows (other problems on that platform).
Joe

Sign in to comment.


Jeff
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
Jan
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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by