Property Name |
Property Value |
||||||||||||||||||
value |
|
||||||||||||||||||
val | Equivalent to the value property above, except that the callback is never called. | ||||||||||||||||||
minmax | Equivalent to the val property above. (For clarity, use this only when the argument has length 2 (i.e. [min max]). | ||||||||||||||||||
callbk | A callback to be executed when the edit text object is changed. If the callback is defined with a string, then: Occurrences of '@VAL' will be replaced with the current value. Occurrences of '@OBJ' will be replaced with the edit text handle. Also, note that if the function is defined as a string argument often consecutive single-quote characters are required (quotes within quotes). In that case, readability can be improved by replacing all sequences of two consecutive single quotes with a double quote character. For example 'disp(''ABC'');' could be written as 'disp("ABC");'. Note that this trick does not work for Matlab callbacks in general, but it does work for any callback defined within a plt(...) function call. |
||||||||||||||||||
enable | -1=invisible, 0=disabled, 1=enabled (default=1). If disabled, the text will still be visible, but may not be modified. | ||||||||||||||||||
incr | The increment value for a numeric edit pseudo object. (default = 1) When you click on the right/left side of the center of the object, the value of the pseudo edit object is increased/decreased by "incr". A negative value of "incr" is used to indicate that the increment factor is in percentage terms instead of absolute. For example, if incr = -0.1 then clicking on the right/left side of the edit object will increase/decrease the edit object's value by 0.1 percent (i.e. from 1000 to 1001 or 999). You can disable the increment/decrement feature in two different ways. The first way is to set the incr parameter to zero. When you do that, left or right clicking on the object will have the same effect (i.e. the edit mode is entering allowing you type in a new value). The second way is to set the incr parameter to inf. In that case you only enter edit mode when you right click on the object (just like when incr=1 or any nonzero number). Left clicking the object will call the callback function but has no other effect. This makes the object behave much like a button except that you can edit the button's value or string. (See below for an example of creating an editable button.) | ||||||||||||||||||
length | The length of the vector allowed as the edit value. Usually, length=1 indicating the edit value must be a scalar. If length=4 (for example), an allowed edit value must be a row or column vector of length 4. Two special cases are length=-1 and length=0. length=-1 is used to indicate that a numeric array of any length is a legal value. length=0 is used for string edit objects i.e. the edit string is not interpreted as a number or vector. (default = 1) | ||||||||||||||||||
format | The number of characters used to display numeric edit objects (default=6). Or you may specify the conversion string to use, such as '%0.4g' or '%3d' or '%4V' (Type "help prin" for a description of the allowed formatting codes.) Note that 'format',5 is equivalent to 'format','%5w' |
||||||||||||||||||
label | If the argument is a string, that string will become the edit pseudo object's label.
Usually, this is sufficient, but if you want more control of the label's position or
appearance the argument may be a cell array of the form: {'LabelString', offset, 'Property1',Value1,'Property2',Value2, ...} Note that the label will be created with the same type as the main edit object (i.e. a uicontrol for type 1 and a text object for type 2). The property names in the cell array must be valid properties for that object type. Note that the label will be created as a text object in the same axis that is used to display the popup choices. Property1, Property2, etc. must all be valid text object property names. The meaning of the offset parameter depends on its length as follows:
| ||||||||||||||||||
***** | If a property name is given which isn't in the list above then the property is applied to the main uicontrol or text object itself. (It must be a valid property name for type of object being used.) The position ('pos') of the edit pseudo object must be set this way. For a type 1 edit pseudo object the foreground/background colors ('foregr' / 'backgr' properties) are usually set this way, however, if these properties are not specified the background color defaults to 0.8 times the figure background color and foreground color defaults to [1 1 .4] or [0 0 .6] (whichever provides the most contrast). The text color of a type 2 edit pseudo object can be set this way as well ('color' property) with its default handled in the same manner as the foreground color for the type 1 object. |
H = plt('edit', 'Property1',Value1, 'Property2',Value2,...) | The property names allowed and the interpretation of the property values are shown in the table above. You may use as many or as few properties as you need in whatever order you choose. If you favor clarity over conciseness, there is no need to consider the alternate forms shown below. |
H = plt('edit',[x y],v, | Usually both the 'position' and 'value' properties are needed, so for conciseness, you may omit those
property names if the property values appear first and in this order.
Note that v in this form may also be a length 3 vector if you
want to specify the min/max values. The position in this example is for a type 2 edit pseudo object
but it could also be a 4 element vector [x y width height]
specifying a type 1 edit object. Assuming at least one of the position coordinates is greater than 3
(indicating pixel units are being used), this command is translated into this line before execution: H = plt('edit','units','pixel','pos',[x y],'val',v,'Property3',Value3,...) If all position coordinates are less than 3 indicating that normal coordinates are being used, the translation is the same except 'pixel' is replaced with 'normal'. |
H = plt('edit',[x y],v,@cb, 'Property4',Value4,...) | This command is equivalent to: H = plt('edit',[x y],v,'callbk',@cb,'Property4',Value4,...) Since most pseudo edit objects will be created with a callback, the 'callbk' property name can also be omitted by specifying the callback immediately after the position and value arguments. In this example the callback is specified by a function handle (@cb) but it may also be specified as a string. Property names other than these three ('pos', 'val', 'callbk') may not be omitted. |
plt('edit',H, 'Property1',Value1, 'Property2',Value2,...) | The specified property values are applied to the edit pseudo object identified by handle H. The property names can be the ones described in the table above as well as standard Matlab property names to be applied to the main uicontrol (for type 1) or text object (for type 2). |
plt('edit',H,'get','value') | returns the numeric value of the specified edit pseudo object.
For conciseness, this command may also be written without the last argument:
|
plt('edit',H,'get','minmax') | returns [min max] - the allowed limits for the value |
plt('edit',H,'get','callbk') | returns the string or function handle that was set via the 'callbk' parameter |
plt('edit',H,'get','enable') | returns -1/0/1 if the pseudo object is hidden/disabled/enabled |
plt('edit',H,'get','incr') | returns the value that was set via the 'incr' parameter |
plt('edit',H,'get','length') | returns the value that was set via the 'length' parameter |
plt('edit',H,'get','format') | returns the string that was set via the 'format' parameter |
plt('edit',H,'get','label') | returns the label handle |
plt('edit',H,'get','cell') | returns an 9 element cell array that is a concatenation of the previous 8 get commands:
|
The 9 'get' commands above also work when H is a vector of pseudo edit handles. For example, suppose
H is a row or column vector containing 4 pseudo edit handles. Then the command
|
<Esc> | The edit text object is closed for editing and the original text value is restored as if the edit object was never opened for editing. |
<Backspace> | Deletes the character on the left side of the cursor. |
<Delete> | Deletes the character on the right side of the cursor. If the cursor is at the end of the string, all the characters are deleted leaving only the underscore cursor. |
Moves the underscore cursor one position to the right. | |
<Left arrow> | Moves the underscore cursor one position to the left. |
Removes all the characters. This is the same as pressing Backspace until only the underscore remains. | |
<Enter> | Closes the edit text object, accepting the current entry (without the underscore cursor) as the new value. |
<Click> | Clicking the mouse on the edit text object while it is open has the same effect as pressing <Esc> on the keyboard. |
i | When entering a scalar value, if lower case "i" (increment) is entered as the last character, this indicates that the entered value should be used as a new "incr" parameter for the object. In this case, the text object value from before the object was opened is retained. |
H = [plt('edit',p1,In2,In3A,In4,In5);
plt('edit',p2,In2,In3B,In4,In5);
plt('edit',p3,In2,In3C,In4,In5)];
In this example, In3 was a cell array while In2, In4, and In5 were not, but it could just as easily be the
other way around, or any other combination. Although this example included 5 arguments, it can have more,
and only the first two arguments (the position and value) are required.
% create 4 pseudo edit objects with values 77,66,55,44
h = plt('edit',arrange(4),{77 66 55 44},'label',{'first' 'second' 'third' 'fourth'});
plt('edit',h) % verify that it worked by displaying the 4 values
plt('edit',h,'val',num2cell(rand(1,4))); % change the 4 values to random numbers
plt('edit',h) % verify that it worked by displaying the 4 values
g = plt('edit',h,'get','label') % get the handles of the labels for each pseudo edit object
set(g,'foregr','black'); % change the labels so that the text color is black
set([h; g],'vis','off'); % make the edit objects including the labels invisible
set([h; g],'vis','on'); % make them visible again
See the following programs for examples of the use of the pseudo edit object:
math folder: | airspeed, circles12, curves, gpsLog, julia |
sig folder: | afilt, editz, erip, psdZoom, winplt |