User`s guide

11 Lay Out a Programmatic GUI
4 Make sure that you know the handle of the component you have
manipulated. In the following code, the handle is a variable n amed
object_handle.
5 Obtain the component position vector from the Property Inspector. Type
inspect
or enter a get statement, such as:
get(object_handle, 'Position')
ans =
15.2500 333.0000 106.0000 20.0000
6 Copy the result (ans) and ins ert it in a set statement in your code file,
within square b rackets :
set(object_handle, 'Position', [15.2500 333.0000 106. 0000 20.0000])
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 exam ple function called
editpos:
function rect = editpos(handle)
% Enters plot edit mode, pauses to let user manipulate ob ject s,
% then turns the mode off. It does not tr ack what user does.
% User later needs to outpu t a Position proper ty, if changed.
if ~ishghand le(h andle)
disp(['=E= gbt_ move obj: Invalid handle : ' inputname(1)])
return
end
plotedit(handle,'on')
disp('=== Se lect , move and resize object. Use mous e and arrow keys.' )
disp('=== Wh en you are finished , press Return to continue.')
pause
11-44