fn_propcontrol
Contents
Syntax
fn_propcontrol(obj,prop,spec,graphic object options...)
fn_propcontrol(obj,prop,spec,{graphic object options...})
hu = fn_propcontrol.createcontrol(...)Description
Create a control that will be synchronized to an object property value. Use the static method fn_propcontrol.createcontrol (3rd syntax above) to return the graphic handle of the control rather than the fn_propcontrol object.
Input:
- obj the object whose property is observed
- prop the name of the observed property THIS PROPERTY MUST BE SET AS
OBSERVABLE, AND ITS SET ACCESS MUST BE PUBLIC
- spec specification of both the value type and the control style:
. for logical values: 'checkbox', 'radiobutton' or 'menu'
. for numerical and char values: 'char', 'double', 'uint8', etc
. for list of values: {spec value1 value2 ...}
or {spec {values...} {labels...} [{shortlabels...}]} where
spec is any of 'listbox', 'checkbox', 'pushbutton', 'menu'
(one entry with sub-entries), 'menuval' (same, and value is
indicated on the top-level entry), 'menugroup' (multiple
entries at the first level) Under these two options, two
special behaviors are available:
* if 'labels' has one value less than 'values', the last
element of 'values' is considered as a default value that
is set when unchecking the current value (such value would
typically be '', [] or 0).
* if on the contrary 'labels' has one more value than
'values' (typically, 'others...'), this label is checked
whenever the property value is not in the list, and when
this label is pressed, a small input window lets the user
select the desired value
- options options for the graphic object that will be created
- If spec is 'menu', 'menuval' or 'menugroup', it is mandatory
that options will contain the pair ('parent',parentmenu).
- Labels should be set with property 'string' for 'checkbox',
'char', 'double', etc., and with property 'label' for
'menu', etc. If not specified, the name of the observed
property is used.
For better readability, options can be nested inside a cell
array.See also: fn_menugroup, fn_control
Source
Thomas Deneux
Copyright 2015-2017