alterator-effect(3)
| alterator-effect(3) | Alterator user manual | alterator-effect(3) |
NAME
(alterator effect) - Interface effects library over (alterator ajax)
SYNOPSIS
(use-modules (alterator effect))
(init-effect)
(update-effect)
(effect-enable target-name check-name
check-value)
(effect-disable target-name check-name check-value)
(effect-show target-name check-name check-value)
(effect-hide target-name check-name check-value)
DESCRIPTION
This library offer a declarative syntax to describe a form effects like a simple constraints. You are describing a dependencies between a some widget's property (e.g. activity, visibility) and a value of a some other widget. This property will be automatically updated every time when value of a dependent widget will change.
For example, some widget will visible only if some checkbox was turned on.
Each widget in these declarations is addressed by name defined in it's name attribute.
All definitions should live in the initial form callback (init or on-load for html, loaded for qt).
You must finish all effects declarations with init-effect function call. These functions automatically binds to all widgets to intercept 'change' event. If you made a some form modification from program, you should call update-effect function manually to see the effect.
One widget can have any number of rules. These rules will be concatenated using 'or' predicate. For example:
(effect-disable "a" "b" "test")
(effect-disable "a" "c" "test")
Widget "a" will disabled if "b" or "c" is equal to "test".
EXAMPLE
Basic html example (file ajax.scm):
(define (init)
(effect-show "generate_button" "auto_passwd" #t)
(init-effect)
...
)
Basic qt example (file index.scm):
(document:root
(when loaded
(effect-show "generate_button" "auto_passwd" #t)
(init-effect)
...
))
In these examples a button for automatic generation will shown only if auto_passwd checkbox is turned on.
FUNCTIONS
- (init-effect)
- Binds an appropriate event handlers according defined effect rules and also call an update-effect function.
- (update-effect)
- Examine current state of widgets and update all properties according defined effect rules.
- (effect-enable target-name check-name check-value)
- Enable "target-name" (a widget with name "target-name") only if the value of "check-name" (a widget with name "target-name").
- (effect-disable target-name check-name check-value)
- Disable "target-name" (a widget with name "target-name") only if the value of "check-name" (a widget with name "target-name").
- (effect-show target-name check-name check-value)
- Show "target-name" (a widget with name "target-name") only if the value of "check-name" (a widget with name "target-name").
- (effect-hide target-name check-name check-value)
- Hide "target-name" (a widget with name "target-name") only if the value of "check-name" (a widget with name "target-name").
AUTHOR
Stanislav Ievlev <inger@altlinux.org>
SEE ALSO
| 22/09/2009 | ALT Linux |
