Fixes for componentized Pagedform
[tcl-tlc.git] / examples / test_radiogroup.tcl
bloba86003bb2e3eab8df6d9b1a775c61da5f5a31090
1 #!/usr/bin/env tclsh8.5
3 source "boilerplate.tcl"
5 proc onselect {key} {
6 puts stderr "onselect: $key"
9 set ::rg1 bar
10 entry .rg1_manual -textvariable ::rg1
11 Radiogroup .rg1 -text "Group 1" -textvariable ::rg1 \
12 -choices {Foo foo Bar bar Baz "hello world"}
14 entry .rg2_manual -textvariable ::rg2
15 Radiogroup .rg2 -text "Group 2" -textvariable ::rg2 \
16 -choices {"Option 1" 1 "Option 2" bar} -orient h
18 entry .rg3_manual -textvariable ::rg3
19 Radiogroup .rg3 -text "Group 3" -textvariable ::rg3 -state disabled \
20 -choices {"Option 1" 1 "Option 2" 2} -orient h -initial_value 2
22 .rg1 register_handler onselect onselect
24 .rg1 set_tips \
25 foo "This is a foo" \
26 bar "Choose a bar instead"
28 Form .form -schema {
29 "Foo" {foo entry}
30 "Bar" {foo radiogroup -choices {"Option 1" 1 "Option 2" 2}}
31 "Baz" {sf subform -winding h -schema {
32 "in subform" {baz radiogroup -choices {"A" a "B" b}}
35 .form set_data foo 1
36 .form set_data sf [list baz a]
38 table . -padx 5 -pady 5 \
39 .rg1_manual 1,1 -anchor w \
40 .rg1 2,1 -fill both \
41 .rg2_manual 3,1 -anchor w \
42 .rg2 4,1 -fill both \
43 .rg3_manual 5,1 -anchor w \
44 .rg3 6,1 -fill both \
45 .form 7,1 -fill both
47 #[Signal_monitor .rg1_monitor -signal_source .rg1] show
48 #[Signal_monitor .rg2_monitor -signal_source .rg2] show
49 [Signal_monitor .rg3_monitor -signal_source .rg3] show