Posted to tcl by patthoyts at Fri Sep 07 01:17:10 GMT 2007view raw
- proc ::tkchat::whiteboard_open {} {
- variable useTile
- variable NS
- if {![winfo exists .wb]} {
- set wb [Dialog .wb]
- ${NS}::entry $wb.e -textvar ::wbentry -width 80
- if {$useTile == 0} { $wb.e configure -background white }
- bind $wb.e <Return> {interp eval .wbinterp $::wbentry}
- set white_board [canvas $wb.c -background white -width 350 -height 300]
- ${NS}::button $wb.bclear -text "clear" -command ::tkchat::whiteboard_clear
- bind $wb.c <Button-1> {
- set entry ""
- set id [%W create line %x %y %x %y]
- }
- bind $wb.c <Button1-Motion> {%W coords $id [concat [%W coords $id] %x %y]}
- bind $wb.c <ButtonRelease-1> {::tkchat::whiteboard_transmit %W $id}
- grid $wb.e $wb.bclear -sticky new
- grid $wb.c - -sticky new
- #pack $wb.e $wb.c -fill both -expand 1
- catch {
- proc filtered_.wb.c {args} {
- if {[string equal "bind" [string tolower [lindex $args 0]] && \
- ([llength $args] == 4)} {
- lset args 3 [list .wbinterp eval [lindex $args 3]]
- }
- set c [catch ".wb.c {*}$args" r]
- return $r -code $c
- }
- interp create -safe .wbinterp
- interp alias .wbinterp .wb.c {} filtered_.wb.c
- }
- } else {
- focus .wb
- }
- }