
Next: The Save funktion
Up: The InitChange, ShowPage and
PageEnd
Previous: Visual variables
Let's try to see the following page:
CheckBox cb1 -text cb1
CheckBox cb2 -text cb2
CheckBox cb3 -text cb3
CheckBox cb4 -text cb4
ExtEntry ee1 -entries cb1 -count 2
ExtEntry ee2 -entries cb2 cb3 ee1 -count 2 \
-subFrame:bd 1 -subFrame:relief sunken
This looks like this:
The following is then true:
- cb4 is always visible
- only one of each element in the extentries is visible at a
time. Ie. both
cb2's can not be visible at the same time (Only one tuple of the
outer extentry can be visible at a time)
- cb2 is only visible if it, cb3 or one of
the cb1 has been selected.
- It's ok to refer to cb2 or cb4 when cb1
is the active element, but not to cb1 when cb2 is the
active element.
The Change function may look like this:
switch $changeElm {
cb4 {
[pick $cb4 Enable Disable] ee2
}
cb2 {
forevery ee1 {
set cb1 $cb2
}
}
cb1 {
if {$cb1 == 1} {
set cb3 1
}
}
}
This is a quite complicated function, but let's see what happens for each
element. The switch function selects one of the following based on which
element is the one changed:
- cb4
- If cb4 is the changed element, then the following line is
evaluated: [pick $cb4 Enable Disable] ee2. The first part just
selects Enable if $cb4 is true and Disable if it is
false. The whole line enables ee2 if cb4 is
checked, otherwise it disables ee2 (This is an example of how
you can enable/disable an extentry.)
- cb2
- If cb2 is selected then all the cb1's are
set according to cb2 (This is an example of the use of
forevery in the Change function.)
- cb1
- If one of the cb1 is checked then cb2 is
also checked.
This is ok since I must reference up, but it was
not ok in the previous, since this would have been a refence down,
and that's not allowed!
This example is included in the demo packages.
Jesper Kjær Pedersen <blackie@imada.ou.dk>
Wed Oct 2 13:29:53 MET DST 1996