diff options
author | treectrl <treectrl> | 2005-05-17 01:29:45 (GMT) |
---|---|---|
committer | treectrl <treectrl> | 2005-05-17 01:29:45 (GMT) |
commit | 6501cddd7fec5b2a3a6fd7c83b4dc76048835fc1 (patch) | |
tree | 3748a69fcd066435c0f3137ef786c838a01e4dcf /demos | |
parent | e03884e6afc36b03c202d669213197420cee9c6c (diff) | |
download | tktreectrl-6501cddd7fec5b2a3a6fd7c83b4dc76048835fc1.zip tktreectrl-6501cddd7fec5b2a3a6fd7c83b4dc76048835fc1.tar.gz tktreectrl-6501cddd7fec5b2a3a6fd7c83b4dc76048835fc1.tar.bz2 |
New demo to show off new -textvariable option of "text" element.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/textvariable.tcl | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/demos/textvariable.tcl b/demos/textvariable.tcl new file mode 100644 index 0000000..66811dd --- /dev/null +++ b/demos/textvariable.tcl @@ -0,0 +1,67 @@ +proc DemoTextvariable {} { + + set T .f2.f1.t + + # + # Configure the treectrl widget + # + + $T configure -showroot no -showbuttons no -showlines no \ + -selectmode extended -xscrollincrement 20 -showheader no + + # Hide the borders because child windows appear on top of them + $T configure -borderwidth 0 -highlightthickness 0 + + # + # Create columns + # + + $T column create -expand yes -tag C0 + $T configure -treecolumn C0 + + # + # Create elements + # + + $T element create eWindow window + $T element create eRect rect + $T element create eText1 text -width 300 + $T element create eText2 text + + # + # Create styles using the elements + # + + set S [$T style create s1 -orient horizontal] + $T style elements $S eText1 + $T style layout $S eText1 -padx 10 -pady 6 + + set S [$T style create s2 -orient vertical] + $T style elements $S {eRect eText2 eWindow} + $T style layout $S eRect -union {eText2 eWindow} -ipadx 8 -ipady 8 -padx 4 -pady {0 4} + $T style layout $S eText2 -pady {0 6} + $T style layout $S eWindow + + # + # Create items and assign styles + # + + set I [$T item create] + $T item style set $I C0 s1 + $T item element configure $I C0 eText1 -text "Each text element and entry widget share the same -textvariable. Editing the text in the entry automatically updates the text element." + $T item lastchild root $I + + foreach i {0 1} color {gray75 "light blue"} { + set I [$T item create] + $T item style set $I C0 s2 + $T item element configure $I C0 eRect -fill [list $color] + $T item element configure $I C0 eText2 -textvariable tvar$I + set e [entry $T.e$I -width 48 -textvariable tvar$I] + $T item element configure $I C0 eWindow -window $e + $T item lastchild root $I + set ::tvar$I "This is item $I" + } + + return +} + |