Fixes for componentized Pagedform
[tcl-tlc.git] / examples / test_checkgroup.tcl
bloba2ebe38e4b1475c083179f131b7ee0ee17f10ceb
1 #!/tcl8.4/bin/wish8.4
3 source "boilerplate.tcl"
5 proc onselect {key} {
6 puts stderr "onselect: $key"
9 entry .cg1_manual -textvariable ::cg1
10 Checkgroup .cg1 -text "Group 1" -textvariable ::cg1 -mode "array" \
11 -choices {Foo foo Bar bar Baz "hello world"}
13 entry .cg2_manual -textvariable ::cg2
14 Checkgroup .cg2 -text "Pick Any Two" -textvariable ::cg2 -mode "picklist" \
15 -choices {Cheap cheap Fast fast Reliable reliable} -orient h
16 array set picktwo {}
17 Gate #auto picktwo(cheap_fast) -mode and
18 Gate #auto picktwo(cheap_reliable) -mode and
19 Gate #auto picktwo(fast_reliable) -mode and
21 $picktwo(cheap_fast) attach_input [.cg2 signal_ref option_cheap]
22 $picktwo(cheap_fast) attach_input [.cg2 signal_ref option_fast]
24 $picktwo(cheap_reliable) attach_input [.cg2 signal_ref option_cheap]
25 $picktwo(cheap_reliable) attach_input [.cg2 signal_ref option_reliable]
27 $picktwo(fast_reliable) attach_input [.cg2 signal_ref option_fast]
28 $picktwo(fast_reliable) attach_input [.cg2 signal_ref option_reliable]
30 .cg2 attach_signal cheap $picktwo(fast_reliable) inverted
31 .cg2 attach_signal fast $picktwo(cheap_reliable) inverted
32 .cg2 attach_signal reliable $picktwo(cheap_fast) inverted
34 .cg1 register_handler onselect onselect
36 .cg1 set_tips \
37 foo "This is a foo" \
38 bar "Choose a bar instead"
40 Form .form -schema {
41 "Foo" {foo entry}
42 "Bar" {foo checkgroup -choices {"Option 1" 1 "Option 2" 2}}
45 table . -padx 5 -pady 5 \
46 .cg1_manual 1,1 -fill x \
47 .cg1 2,1 -fill both \
48 .cg2_manual 3,1 -fill x \
49 .cg2 4,1 -fill both \
50 .form 5,1 -fill both
52 [Signal_monitor .cg1_monitor -signal_source .cg1] show
53 [Signal_monitor .cg2_monitor -signal_source .cg2] show