diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2001-10-30 11:21:50 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2001-10-30 11:21:50 (GMT) |
commit | 1e8f324bf3e3448bd0371bc5139de33f2f4a1395 (patch) | |
tree | b1db95e8bca8b0fec32a78d0d8dc17febdf58972 /library/demos | |
parent | 7a22b0cc08ac0cb685315130f93ed8d579b29daa (diff) | |
download | tk-1e8f324bf3e3448bd0371bc5139de33f2f4a1395.zip tk-1e8f324bf3e3448bd0371bc5139de33f2f4a1395.tar.gz tk-1e8f324bf3e3448bd0371bc5139de33f2f4a1395.tar.bz2 |
Improvements to widget demo (integrates/demonstrates the new 8.4 widgets)
Diffstat (limited to 'library/demos')
-rw-r--r-- | library/demos/labelframe.tcl | 7 | ||||
-rw-r--r-- | library/demos/spin.tcl | 55 | ||||
-rw-r--r-- | library/demos/widget | 23 |
3 files changed, 71 insertions, 14 deletions
diff --git a/library/demos/labelframe.tcl b/library/demos/labelframe.tcl index 89931cf..af8954b 100644 --- a/library/demos/labelframe.tcl +++ b/library/demos/labelframe.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a toplevel window containing # several labelframe widgets. # -# RCS: @(#) $Id: labelframe.tcl,v 1.1 2001/09/26 21:36:19 pspjuth Exp $ +# RCS: @(#) $Id: labelframe.tcl,v 1.2 2001/10/30 11:21:50 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -19,7 +19,8 @@ positionWindow $w # Some information label $w.msg -font $font -wraplength 4i -justify left -text "Labelframes are\ -typically used to group related widgets together." + used to group related widgets together. The label may be either \ + plain text or another widget." pack $w.msg -side top # The bottom buttons @@ -42,7 +43,7 @@ labelframe $w.f -text "Value" -padx 2 -pady 2 grid $w.f -row 0 -column 0 -pady 2m -padx 2m foreach value {1 2 3 4} { - radiobutton $w.f.b$value -text $value -width 3 \ + radiobutton $w.f.b$value -text "This is value $value" \ -variable lfdummy -value $value pack $w.f.b$value -side top -fill x -pady 2 } diff --git a/library/demos/spin.tcl b/library/demos/spin.tcl new file mode 100644 index 0000000..61b4a38 --- /dev/null +++ b/library/demos/spin.tcl @@ -0,0 +1,55 @@ +# spin.tcl -- +# +# This demonstration script creates several spinbox widgets. +# +# RCS: @(#) $Id: spin.tcl,v 1.1 2001/10/30 11:21:50 dkf Exp $ + +if {![info exists widgetDemo]} { + error "This script should be run from the \"widget\" demo." +} + +set w .spin +catch {destroy $w} +toplevel $w +wm title $w "Spinbox Demonstration" +wm iconname $w "spin" +positionWindow $w + +label $w.msg -font $font -wraplength 5i -justify left -text "Three different\ + spin-boxes are displayed below. You can add characters by pointing,\ + clicking and typing. The normal Motif editing characters are\ + supported, along with many Emacs bindings. For example, Backspace\ + and Control-h delete the character to the left of the insertion\ + cursor and Delete and Control-d delete the chararacter to the right\ + of the insertion cursor. For values that are too large to fit in the\ + window all at once, you can scan through the value by dragging with\ + mouse button2 pressed. Note that the first spin-box will only permit\ + you to type in integers, and the third selects from a list of\ + Australian cities." +pack $w.msg -side top + +frame $w.buttons +pack $w.buttons -side bottom -fill x -pady 2m +button $w.buttons.dismiss -text Dismiss -command "destroy $w" +button $w.buttons.code -text "See Code" -command "showCode $w" +pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 + +set australianCities { + Canberra Sydney Melbourne Perth Adelaide Brisbane + Hobart Darwin "Alice Springs" +} + +spinbox $w.s1 -from 1 -to 10 -width 10 -validate key \ + -vcmd {string is integer %P} +spinbox $w.s2 -from 0 -to 3 -increment .5 -format %05.2f -width 10 +spinbox $w.s3 -values $australianCities -width 10 + +#entry $w.e1 +#entry $w.e2 +#entry $w.e3 +pack $w.s1 $w.s2 $w.s3 -side top -pady 5 -padx 10 ;#-fill x + +#$w.e1 insert 0 "Initial value" +#$w.e2 insert end "This entry contains a long value, much too long " +#$w.e2 insert end "to fit in the window at one time, so long in fact " +#$w.e2 insert end "that you'll have to scan or scroll to see the end." diff --git a/library/demos/widget b/library/demos/widget index 7d0d662..0dbb6df 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.3 2001/09/26 21:36:19 pspjuth Exp $ +# RCS: @(#) $Id: widget,v 1.4 2001/10/30 11:21:50 dkf Exp $ eval destroy [winfo child .] wm title . "Widget Demonstration" @@ -144,6 +144,8 @@ This application provides a front end for several short scripts that demonstrate .t insert end "8. A simple user interface for viewing images." \ {demo demo-image2} .t insert end " \n " {demospace} +.t insert end "9. Labelled frames." {demo demo-labelframe} +.t insert end " \n " {demospace} .t insert end \n {} "Listboxes" title .t insert end " \n " {demospace} @@ -155,13 +157,15 @@ This application provides a front end for several short scripts that demonstrate .t insert end "3. A collection of famous sayings." {demo demo-sayings} .t insert end " \n " {demospace} -.t insert end \n {} "Entries" title +.t insert end \n {} "Entries and Spin-boxes" title +.t insert end " \n " {demospace} +.t insert end "1. Entries without scrollbars." {demo demo-entry1} .t insert end " \n " {demospace} -.t insert end "1. Without scrollbars." {demo demo-entry1} +.t insert end "2. Entries with scrollbars." {demo demo-entry2} .t insert end " \n " {demospace} -.t insert end "2. With scrollbars." {demo demo-entry2} +.t insert end "3. Spin-boxes." {demo demo-spin} .t insert end " \n " {demospace} -.t insert end "3. Simple Rolodex-like form." {demo demo-form} +.t insert end "4. Simple Rolodex-like form." {demo demo-form} .t insert end " \n " {demospace} .t insert end \n {} "Text" title @@ -210,12 +214,6 @@ This application provides a front end for several short scripts that demonstrate {demo demo-menubu} .t insert end " \n " {demospace} -.t insert end \n {} "Labelframes" title -.t insert end " \n " {demospace} -.t insert end "1. Labelframe." \ - {demo demo-labelframe} -.t insert end " \n " {demospace} - .t insert end \n {} "Common Dialogs" title .t insert end " \n " {demospace} .t insert end "1. Message boxes." {demo demo-msgbox} @@ -395,3 +393,6 @@ proc aboutBox {} { Copyright (c) 1996-1997 Sun Microsystems, Inc." } +# Local Variables: +# mode: tcl +# End: |