Artifact
765fc5e266a3706753288b8104c5daea9109ad21:
Attachment "zclicks.tcl" to
ticket [2838812f]
added by
patthoyts
2010-01-04 06:31:38.
package require Tk
variable uid 0
proc ContextHelp {} {
variable uid
set dlg [toplevel .chelp[incr uid] -class Dialog]
wm title $dlg "Context help test $uid"
wm transient $dlg [winfo parent $dlg]
catch {wm attributes $dlg -contexthelp 1}
button $dlg.b -text Button -command [list $dlg.b configure -text Clicked]
checkbutton $dlg.c -text Checkbutton
set ::$dlg 0
radiobutton $dlg.r0 -text "Thing one" -variable ::$dlg -value 1
radiobutton $dlg.r1 -text "Thing two" -variable ::$dlg -value 2
foreach w {b c r0 r1} {
bind $dlg.$w <ButtonPress-1> {Log "ButtonPress-1 %W"}
bind $dlg.$w <ButtonRelease-1> {Log "ButtonRelease-1 %W"}
}
grid $dlg.b -sticky news
grid $dlg.c -sticky news
grid $dlg.r0 -sticky news
grid $dlg.r1 -sticky news
}
proc Log {s} {
.t insert end $s\n {}
.t see end
}
button .b -text "Waiting" -height 30 -width 100 \
-command {.b configure -text Pressed; Log "Pressed .b"}
text .t -height 4 -background white -width 30 -yscrollcommand {.vs set}
scrollbar .vs -command {.t yview}
frame .buttons -relief flat
button .test -text Test -width -10 -command {
.b configure -text "Waiting"
after idle [list tk_getOpenFile]
}
button .chlp -text ContextHelp -command ContextHelp
button .exit -text Exit -width -10 -command exit
bind . <Control-F2> {console show}
bind .b <ButtonPress-1> {Log "ButtonPress-1 %W\n"}
bind .b <ButtonRelease-1> {Log "ButtonRelease-1 %W"}
bind all <<Help>> {Log "Help %W"}
grid .test .chlp .exit -in .buttons -sticky e
grid columnconfigure .buttons 0 -weight 1
grid .b - -padx 2 -pady 2
grid .t .vs -sticky news
grid .buttons - -sticky news
grid rowconfigure . 1 -weight 1
grid columnconfigure . 0 -weight 1