MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manuel d'utilisateur Page 370

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 500
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 369
10 Lay Out a Programmatic UI
10-38
'Units','pixels',...
'Tag','ax');
end
function plotsine(hObject,callbackdata)
theta = 0:pi/64:6*pi;
y = sin(theta);
plot(hs.ax,theta,y);
end
function resizeui(hObject,callbackdata)
% Get figure width and height
figwidth = hs.fig.Position(3);
figheight = hs.fig.Position(4);
% Set button position
bheight = 30;
bwidth = 70;
bbottomedge = figheight - bheight - 50;
bleftedge = 10;
hs.btn.Position = [bleftedge bbottomedge bwidth bheight];
% Set axes position
axheight = .75*figheight;
axbottomedge = max(0,figheight - axheight - 30);
axleftedge = bleftedge + bwidth + 30;
axwidth = max(0,figwidth - axleftedge - 50);
hs.ax.Position = [axleftedge axbottomedge axwidth axheight];
end
end
The resizeui function sets the location and size of the button and axes whenever the
user resizes the window:
The button height, width, and left edge stay the same when the window resizes.
The bottom edge of the button, bbottomedge, allows 50 pixels of space between the
top of the figure and the top of the button.
The value of the axes height, axheight, is 75% of the available height in the figure.
The value of the axes bottom edge, axbottomedge, allows 30 pixels of space between
the top of the figure and the top of the axes. In this calculation, the max function
limits this value to nonnegative values.
Vue de la page 369
1 2 ... 365 366 367 368 369 370 371 372 373 374 375 ... 499 500

Commentaires sur ces manuels

Pas de commentaire