[go: up one dir, main page]

File: sgtest.tcl

package info (click to toggle)
tile 0.8.2-2.1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 3,152 kB
  • ctags: 3,093
  • sloc: ansic: 18,144; tcl: 4,607; makefile: 398; sh: 71
file content (52 lines) | stat: -rw-r--r-- 1,581 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# sgtest.tcl,v 1.1 2006/08/05 23:18:30 jenglish Exp
#
# Interactive test driver for sizegrip widget.
#

package require Tk
package require tile

source [file join [file dirname [info script]] testutils.tcl]

variable setgrid 0
proc setsetgrid {w} { $w configure -setgrid $::setgrid }

variable wmgeometry
bind . <Configure> { set ::wmgeometry [wm geometry .] }

set tb [ttk::frame .toolbar]
pack \
    [ttk::checkbutton $tb.cb -text "Setgrid?" \
	-command [list setsetgrid .tt] -variable setgrid] \
    [ttk::button $tb.tl -text "+50+50" \
	-command [list wm geometry . +50+50]] \
    [ttk::button $tb.br -text "-50-50" \
	-command [list wm geometry . -50-50]] \
    [ttk::button $tb.cg -text "Reset geometry" \
    	-command [list wm geometry . {}]] \
    -side left -anchor w -padx 3 -pady 3
pack \
    [ttk::label $tb.geometry -width 20 -textvariable wmgeometry] \
    -side right

ttk::sizegrip .grip
ttk::scrollbar .vsb -orient vertical -command [list .tt yview]
ttk::scrollbar .hsb -orient horizontal -command [list .tt xview]
text .tt -setgrid $setgrid -wrap none \
    -xscrollcommand [list .hsb set] -yscrollcommand [list .vsb set] \
    -highlightthickness 0

.tt insert end [read [set fp [open [info script]]]] ; close $fp

grid .toolbar -row 0 -columnspan 2 -sticky nsew
grid .tt   -row 1 -column 0 -sticky nsew
grid .vsb  -row 1 -column 1 -sticky nse
grid .hsb  -row 2 -column 0 -sticky sew
grid .grip -row 2 -column 1 -sticky senw ;# -sticky se
grid columnconfigure . 0 -weight 1
grid rowconfigure . 1 -weight 1

bind all <KeyPress-Escape> [list destroy .]

#*EOF*