User`s guide
8 Programming a GUIDE GUI
2 Create callbacks for the two push buttons, and place the follow ing line of
code in each of them.
set(gcbf,'Position',[420 520 150 190])
This resets the GUI to its initial size, so you c an experiment with resizing
it manually.
3 In the Property Inspector, set the Unit s of the panel and the two buttons to
normalized.AlsosetthefontSiz e of both buttons to 10. Make sure that
the
fontUnits property for both buttons is set to p oints.
4 Create a ResizeFcn callback for the panel by Clicking the pencil icon for the
ResizeFcn in the Property Inspector and insert the following code into it.
function uipane l1_R esizeFcn(hObject, e vent data, handles)
.
.
.
set(hObject,'Units','Points') % Was normalized
panelSizePts = get(hObject,'Position'); % Now in points
panelHeight = panelSizePts(4);
set(hObject,'Units','normalized'); % Now normalized again
% Keep fontsize in constant ratio to heigh t of panel
newFontSize = 10 * panelHeight / 115; % Calculated in points
buttons = get(hObject,'Children ');
8-40