|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
You can examine or set the value of a widget by using the widget object
that was returned by
Important: You must call
modifying the value of a widget before the user is allowed to edit the
widget again. It is enough to call
widget-setup once if you
modify multiple widgets. This is currently only necessary if the widget
contains an editing field, but may be necessary for other widgets in the
If your application needs to associate some information with the widget
objects, for example a reference to the item being edited, it can be
widget-get. The property names
must begin with a `:'.
nilif widget has a value (even
nil) for property property.
Occasionally it can be useful to know which kind of widget you have, i.e. the name of the widget type you gave when the widget was created.
Widgets can be in two states: active, which means they are modifiable by the user, or inactive, which means they cannot be modified by the user. You can query or set the state with the following code:
;; Examine if widget is active or not. (if (widget-apply widget :active) (message "Widget is active.") (message "Widget is inactive.") ;; Make widget inactive. (widget-apply widget :deactivate) ;; Make widget active. (widget-apply widget :activate)
A widget is inactive if it, or any of its ancestors (found by
:parent link), have been deactivated. To make sure
a widget is really active, you must therefore activate both it and
all its ancestors.
(while widget (widget-apply widget :activate) (setq widget (widget-get widget :parent)))
You can check if a widget has been made inactive by examining the value
:inactive keyword. If this is non-
nil, the widget itself
has been deactivated. This is different from using the
keyword, in that the latter tells you if the widget or any of
its ancestors have been deactivated. Do not attempt to set the
:inactive keyword directly. Use the
:deactivate keywords instead.
|[ << ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|