MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE User's Guide Page 308

  • Download
  • Add to my manuals
  • Print
  • Page
    / 759
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 307
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
Page view 307
1 2 ... 303 304 305 306 307 308 309 310 311 312 313 ... 758 759

Comments to this Manuals

No comments