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

  • 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 373
10 Lay Out a Programmatic UI
10-42
Tip Instead of using a separate set command, after you decide upon a position for the
object, you can modify the statement in your code file that creates the object to include
the Position parameter and value.
To position components systematically, you can create a function to manage the process.
Here is a simple example function called editpos:
function rect = editpos(handle)
% Enters plot edit mode, pauses to let user manipulate objects,
% then turns the mode off. It does not track what user does.
% User later needs to output a Position property, if changed.
if ~ishghandle(handle)
disp(['=E= gbt_moveobj: Invalid handle: ' inputname(1)])
return
end
plotedit(handle,'on')
disp('=== Select, move and resize object. Use mouse and arrow keys.')
disp('=== When you are finished, press Return to continue.')
pause
rect = handle.Position;
inspect(handle)
To experiment with the function, enter the following code in the Command Window:
hfig = figure;
hsl = uicontrol('Style','slider')
editpos(hsl)
After you call editpos, the following prompt appears:
=== Select, move and resize the object. Use mouse and arrow keys.
=== When you are finished, press Return to continue.
When you first enter plot edit mode, the selection is figure itself. Click the slider to select
it and reposition it. For example, move it to the right side of the figure and orient it
vertically, as shown in the following figure.
Vue de la page 373
1 2 ... 369 370 371 372 373 374 375 376 377 378 379 ... 499 500

Commentaires sur ces manuels

Pas de commentaire