ah! I already seen that, and forgotten about that.
In the last hour I read all available docs at: http://suita.chopin.edu.pl/~czaja/miXed/externs/
but still something isn't clear to me, also looking at the example widfiles
in addition I tried to port my app to toxy (see attached file), but it goes in an endless loop (resizing the pd window) withouth giving errors, so I am unable to debug it...
Hans-Christoph Steiner ha scritto:
You can do that with the toxy lib, I believe [widget] and [tot] are the objects you want. They are included in Pd-extended.
[wish ui.tk( | [shell] | [route mypath ...] | ...
#> table trk Tktable #. -rows 16 -cols 8 -height 16 -width 8 #. -colwidth 3 -drawmode slow -sparsearray 0 -titlerows 0 -titlecols 1 #. -selectmode extended -selecttype row -resizeborders none #. -colstretchmode unset -rowstretchmode none -rowtagcommand {t_rowtags} #. -coltagcommand {t_coltags} -autoclear 1 -command {t_command %r %c %s} #. -validate 1 -validatecommand {t_validate %S}
#. @element t_set
proc t_set {r c v} { }
array set table { rows 16 cols 8 wid .- msgid {} cmdset {element %r %c %s} cmdget {element %r %c} coltype {t1 t0 t0 t0 t0 t0 t0 t0} colw {3 3 3 3 3 3 3 3} valmin 0 valmax 127 data {} }
proc clip_val {v} { global table if {$v < $table(valmin)} {return $table(valmin)} if {$v > $table(valmax)} {return $table(valmax)} return $v } proc t_resize_data {} { global table set old $table(data) set table(data) [list] for {set x 0} {$x < $table(cols)} {incr x} { for {set y 0} {$y < $table(rows)} {incr y} { lappend table(data) "" } } } proc t_rowtags {row} { if {$row%4==0} { return oddrow } } proc t_coltags {col} { global table if {$col == [expr $table(cols)-1]} { return disabled } elseif {$col >= 1} { return [lindex $table(coltype) [expr $col-1]] } } proc t_command {r c v} { global table set index [expr $r * $table(cols) + $c] if {$v == ""} { if {$c == 0} { return [expr $r+1]; } else { .< [t_do_cmd cmdget $r $c $v] .> return [lindex $table(data) $index] } } else { .< [t_do_cmd cmdset [expr $r+1] $c $v] .> lset table(data) $index $v } } proc t_do_cmd {cmd r c v} { global table set m [list] lappend m $table(msgid) foreach vv $table($cmd) { if {"$vv" == "%r"} { lappend m $r } elseif {"$vv" == "%c"} { lappend m $c } elseif {"$vv" == "%s"} { lappend m $v } else { lappend m $vv } } return "[join $m { }];" } proc t_validate {new} { global CURRENT set clipped [clip_val $new] if {$new == {}} { return 1 } elseif {$new != $clipped} { set CURRENT $clipped return 0 } else { return 1 } }
set colw [list] ; set j 0 lappend colw 0 ; lappend colw 2 foreach {w} $table(colw) {incr j; lappend colw $j; lappend colw $w} eval $table(wid) width $colw $table(wid) tag config oddrow -bg gray -fg black $table(wid) tag config t0 $table(wid) tag config t1 -bg green $table(wid) tag config sel -bg blue -fg white $table(wid) tag config active -bg blue -fg white $table(wid) tag config disabled -state disabled grid $table(wid) -row 0 -column 0 -sticky news grid columnconfig . 0 -weight 1 grid rowconfig . 0 -weight 1
entry .cmd grid .cmd -row 1 -sticky ew
bind $table(wid) <Key-colon> {focus .cmd; break} bind $table(wid) <Key-Return> {break} bind .cmd <Key-Up> \ {focus $table(wid); event generate $table(wid) <Key-Up>; focus .cmd; break} bind .cmd <Key-Down> \ {focus $table(wid); event generate $table(wid) <Key-Down>; focus .cmd; break}
t_resize_data