From b3a15eee3ab2d393dcdbe9a87ad354755a2f9a86 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Fri, 3 Oct 2003 12:08:32 +0000 Subject: *** empty log message *** svn path=/trunk/externals/miXed/; revision=1064 --- test/toxy/button-test.pd | 16 ++++++++-------- test/toxy/default.wid | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/toxy/button-test.pd b/test/toxy/button-test.pd index 1f553dd..1fff19f 100644 --- a/test/toxy/button-test.pd +++ b/test/toxy/button-test.pd @@ -12,14 +12,14 @@ red -command .<.>; #X msg 21 21 -bg red -text red; #X msg 34 47 -bg green -text green; #X msg 56 101 -bg gray -text ""; -#X msg 62 132 -activebackground \$1; #X msg 250 74 query tk_chooseColor; #X obj 250 101 tot .; #X msg 166 187 -command .<:t1 bang.>; -#X msg 90 213 -command .(set c [tk_chooseColor] .: eval .<| "-bg" $c -"-text" $c.>.); #X msg 68 186 -width \$1; #X floatatom 68 162 5 0 0 0 - - -; +#X msg 62 132 set -activebackground \$1; +#X msg 90 213 -command .(set c [tk_chooseColor] .: eval .<| set "-bg" +$c "-text" $c.>.); #X connect 0 0 3 0; #X connect 1 0 0 0; #X connect 2 0 0 0; @@ -28,10 +28,10 @@ red -command .<.>; #X connect 7 0 0 0; #X connect 8 0 0 0; #X connect 9 0 0 0; -#X connect 10 0 0 0; -#X connect 11 0 12 0; -#X connect 12 0 10 0; +#X connect 10 0 11 0; +#X connect 11 0 15 0; +#X connect 12 0 0 0; #X connect 13 0 0 0; -#X connect 14 0 0 0; +#X connect 14 0 13 0; #X connect 15 0 0 0; -#X connect 16 0 15 0; +#X connect 16 0 0 0; diff --git a/test/toxy/default.wid b/test/toxy/default.wid index e9a20a1..abe9a5a 100644 --- a/test/toxy/default.wid +++ b/test/toxy/default.wid @@ -3,6 +3,54 @@ # LATER ask for adding something of the sort to pd.tk: bind Canvas <1> {+focus %W} +proc ::toxy::itemleave {path target varname} { + if {[catch {$path get} ::toxy::itemvalue] == 0} { + set $varname $::toxy::itemvalue +# LATER try sending only if changed + pd $target.rp _value $::toxy::itemvalue \; + } +} + +proc ::toxy::itemvis {tkclass path target name varname cvpath px py} { + set ::toxy::itemfailure [catch {$tkclass $path} ::toxy::itemerrmess] + if {$::toxy::itemfailure} { + pd $target.rp _failure $::toxy::itemerrmess \; + } else { + + if {[info exists ::toxy::itemoptions]} { + catch {eval $path config $::toxy::itemoptions} + unset ::toxy::itemoptions + } + + $cvpath create window $px $py \ + -anchor nw -window $path -tags [concat toxy$name $target] + + if {[info exists ::toxy::masterinits]} { + catch {eval $::toxy::masterinits} + unset ::toxy::masterinits + } + if {[info exists ::toxy::typeinits]} { + catch {eval $::toxy::typeinits} + unset ::toxy::typeinits + } + if {[info exists ::toxy::iteminits]} { + catch {eval $::toxy::iteminits} + unset ::toxy::iteminits + } + + pd $target.rp _config $target.rp [$path cget -bg] \ + [winfo reqwidth $path] [winfo reqheight $path] \ + [catch {$path config -state normal}]\; + +# LATER think where to plug this in + bind $path [concat ::toxy::itemleave $path $target $varname] + if {[info exists $varname]} { + catch {eval $path set $$varname} + unset $varname + } + } +} + proc ::toxy::popup {path target remote entries args} { eval {menu $path.pop} $args set i 1 -- cgit v1.2.1