diff options
author | vincentdarley <vincentdarley> | 2003-12-04 12:28:37 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2003-12-04 12:28:37 (GMT) |
commit | 47e501aa09d090cd62bbc979a612a58fb68c4701 (patch) | |
tree | 04619a013d63ec2ed7ca9fa04e83d6cc561c8016 /library | |
parent | a76a88dd975af2c49baceb473c4b1ace2c108b00 (diff) | |
download | tk-47e501aa09d090cd62bbc979a612a58fb68c4701.zip tk-47e501aa09d090cd62bbc979a612a58fb68c4701.tar.gz tk-47e501aa09d090cd62bbc979a612a58fb68c4701.tar.bz2 |
fix to text widget tabs and xy-scroll-command
Diffstat (limited to 'library')
-rw-r--r-- | library/demos/twind.tcl | 67 | ||||
-rw-r--r-- | library/demos/widget | 4 |
2 files changed, 67 insertions, 4 deletions
diff --git a/library/demos/twind.tcl b/library/demos/twind.tcl index d03c818..48a0c20 100644 --- a/library/demos/twind.tcl +++ b/library/demos/twind.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a text widget with a bunch of # embedded windows. # -# RCS: @(#) $Id: twind.tcl,v 1.4 2003/08/20 23:02:18 hobbs Exp $ +# RCS: @(#) $Id: twind.tcl,v 1.5 2003/12/04 12:28:37 vincentdarley Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -12,7 +12,7 @@ if {![info exists widgetDemo]} { set w .twind catch {destroy $w} toplevel $w -wm title $w "Text Demonstration - Embedded Windows" +wm title $w "Text Demonstration - Embedded Windows and Other Features" wm iconname $w "Embedded Windows" positionWindow $w @@ -41,6 +41,12 @@ button $t.click -text "Click Here" -command "textWindPlot $t" \ button $t.delete -text "Delete" -command "textWindDel $w" \ -cursor top_left_arrow +$t insert end "A text widget can contain many different kinds of items, " +$t insert end "both active and passive. It can lay these out in various " +$t insert end "ways, with wrapping, tabs, centering, etc. In addition, " +$t insert end "when the contents are too big for the window, smooth " +$t insert end "scrolling in all directions is provided.\n\n" + $t insert end "A text widget can contain other widgets embedded " $t insert end "it. These are called \"embedded windows\", " $t insert end "and they can consist of arbitrary widgets. " @@ -97,6 +103,63 @@ foreach color {AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4 } $t tag add buttons $t.default end +button $t.bigB -text "Big borders" -command "textWindBigB $t" \ + -cursor top_left_arrow +button $t.smallB -text "Small borders" -command "textWindSmallB $t" \ + -cursor top_left_arrow +button $t.bigH -text "Big highlight" -command "textWindBigH $t" \ + -cursor top_left_arrow +button $t.smallH -text "Small highlight" -command "textWindSmallH $t" \ + -cursor top_left_arrow +button $t.bigP -text "Big pad" -command "textWindBigP $t" \ + -cursor top_left_arrow +button $t.smallP -text "Small pad" -command "textWindSmallP $t" \ + -cursor top_left_arrow + +set text_normal(border) [$t cget -borderwidth] +set text_normal(highlight) [$t cget -highlightthickness] +set text_normal(pad) [$t cget -padx] + +$t insert end "\nYou can also change the usual border width and " +$t insert end "highlightthickness and padding.\n" +$t window create end -window $t.bigB +$t window create end -window $t.smallB +$t window create end -window $t.bigH +$t window create end -window $t.smallH +$t window create end -window $t.bigP +$t window create end -window $t.smallP + +$t insert end "\n\nFinally, images fit comfortably in text widgets too:" + +$t image create end -image \ + [image create bitmap -file [file join $tk_demoDirectory images face.bmp]] + + +proc textWindBigB w { + $w configure -borderwidth 15 +} + +proc textWindBigH w { + $w configure -highlightthickness 15 +} + +proc textWindBigP w { + $w configure -padx 15 -pady 15 +} + +proc textWindSmallB w { + $w configure -borderwidth $::text_normal(border) +} + +proc textWindSmallH w { + $w configure -highlightthickness $::text_normal(highlight) +} + +proc textWindSmallP w { + $w configure -padx $::text_normal(pad) -pady $::text_normal(pad) +} + + proc textWindOn w { catch {destroy $w.scroll2} set t $w.f.text diff --git a/library/demos/widget b/library/demos/widget index 4a1c3c5..a0c1458 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -11,7 +11,7 @@ exec wish "$0" "$@" # ".tcl" files is this directory, which are sourced by this script # as needed. # -# RCS: @(#) $Id: widget,v 1.20 2003/11/05 13:31:12 dkf Exp $ +# RCS: @(#) $Id: widget,v 1.21 2003/12/04 12:28:37 vincentdarley Exp $ package require Tcl 8.4 package require Tk 8.4 @@ -298,7 +298,7 @@ addDemoSection "Text" { text "Basic editable text" style "Text display styles" bind "Hypertext (tag bindings)" - twind "A text widget with embedded windows" + twind "A text widget with embedded windows and other features" search "A search tool built with a text widget" } addDemoSection "Canvases" { |