Prev: ANNOUNCE: Plotchart 1.8.3
Next: Announce: BWidget 1.9.2
From: Zhang Weiwu on 7 Jun 2010 22:04 On 2010年06月08日 00:48, Joe English wrote: > A side question: what are you using detached items for? > I added that method mostly because I thought it might be > useful and it was to implement, but I haven't found a use > case for them myself. > I have a complicated multi-column list, and user are given ability to show those interests him. But what actually interests him is implemented in program logic instead of inside the widget. It is a "filter" of some sort. An method like elide in text widget would work well for me too. In fact it is perhaps better than detach, because it makes tcl/ttk easier to learn for those who already managed text widget.
From: Zhang Weiwu on 7 Jun 2010 22:35 On 2010年06月08日 03:31, Thomas MENEZ wrote: > Been there, done that. I had to manage the list of detached elements > myself :( > Did you make a wrapper widget (mega widget) out of this need? Just think if you did, you probably can post it to tcl.tk wiki and share with others (I would really find it useful), before next version have better solution.
From: Zhang Weiwu on 8 Jun 2010 23:39
On 2010年06月08日 10:35, Zhang Weiwu wrote: > Did you make a wrapper widget (mega widget) out of this need? Just think > if you did, you probably can post it to tcl.tk wiki and share with > others (I would really find it useful), before next version have better > solution. > Having seen no answer I guess I had to write anew. I am a bit curious, as tck 8.5 includes ttk, there should be many discussion related to ttk widgets on tcl.tk website, and ttk/tile might close & move their discussion forum to tcl.tk. But there are few discussion of ttk widgets there on wiki.tcl.tk, thus I am not even sure if I should post my humble wrapper script there. Perhaps I should post to tcl.ttk? (Just joking) Here is what I made, as tcl newbie I must have a lot of mistakes. rename $f.tree $f.tree.internal # ------- proc ------- # change the behavior of this treeview widget so that # it returns an index of -1 when the item is detached. # original idea is from # news:slrni0q8m2.4ji.jenglish(a)eurydice.office.flightlab.com # -------------------- proc $f.tree {args} [string map [list WIDGET $f.tree] { static detached if {! [info exist detached]} {set detached [list]} switch [lindex $args 0] { "index" { if {[lindex $args 1] in $detached} { return -1 } else { return [eval WIDGET.internal $args] } } "move" { if {[lindex $args 1] in $detached} { set detached [lsearch -all -inline -exact -not $detached [lindex $args 1]] } return [eval WIDGET.internal $args] } "detach" { set detached [concat $detached [lrange $args 1 end]] return [eval WIDGET.internal $args] } "default" { return [eval WIDGET.internal $args] } } }] } |