How can I change the default units in GUIDE
6 次查看(过去 30 天)
显示 更早的评论
Hello, I use GUIDE for many of my GUIs. I like using 'pixels' for the figure and all uicontrols. Unfortunately, the default units are 'characters' and I have to manually change the unit value for every new uicontrol I add.
Is there a way to change the default units?
Thank you, Yuval
0 个评论
回答(4 个)
Image Analyst
2014-4-17
You can't change the default as far as I know. You need to set up each one. However they don't need to be done one at a time in the Property Inspector, and you don't need to write something into every CreateFcn. You can set them all as a group (well almost all). What you can do is to drag a box around all the controls on your figure to select all of them. Then double-click on any one of them to bring up the Property Inspector. It will list only those properties that apply to all of them, and some will be missing because some controls don't have certain properties. Fortunately "Units" is one of those that will be shown. You can change the units to pixels for all the controls that you have selected, then close the property inspector. The only ones it won't apply to are those controls that are located inside a panel (group box). For those you have to set them one at a time.
0 个评论
nl2605
2014-4-17
In the CreateFcn you can change the units as you want them to be. But yes, you will have to write it in every CreateFcn of your figure components.
0 个评论
Sean de Wolski
2014-4-17
In general, you can do this if you were making programmatic UIs. However, GUIDE sets its own defaults that can't be changed to my knowledge.
With a regular figure:
hFig = figure;
set(hFig,'Defaultuicontrolunits','pixels')
set(hFig,'Defaultaxesunits','pixels')
set(hFig,'Defaultuipanelunits','pixels')
I would recommend IA's approach. You can also right click a graphics component in GUIDE to make a copy of it. That way you change the properties once, right click and drag to get an identical object.
1 个评论
Image Analyst
2014-4-17
Neat trick (right click and drag). I was always using control c, control v to create a copy of a control.
Robert Thomas
2022-9-30
majority of students find to be quite uninteresting and challenging It is because they place a greater emphasis on raising their grades than on developing their creativity It is true that you must adhere to the instructions provided by your professor sad story ideas There are some times when in life things do not go the way we want We have no choice but to accept them as they are or deal with them.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!