Thanks!

There is actually a more modular way of changing tree labels
by using the vTcl(<class>,get_widget_tree_label) functions
(which requires adding a new parameter, the widget whose
label is of interest).

I am going to add one get_widget_tree_label proc for radios,
checkbuttons and other widgets.

I already used this mechanism for Iwidgets.

Christian Gavin

Eric Taylor wrote:
> 
> Hi,
> 
> I am new to this board. I just found the
> 1.2.1 version of vtcl and I was wondering
> if this is the latest version. I see talk
> about a 1.4 and previously i had tried
> a 1.3 which was unstable.
> 
> As a user/developer, I was very jazzed by the
> new 1.2.1 tree features (amongst others) and
> when i saw the new labels for the tree i just
> had to add my own to those. I esp liked the
> -textvariable xxx that shows up for text entry
> widgets. So, finding the code this (in tree.tcl)
> I quickly added my own for radiobutton variable
> and value, and then added more info for label,
> button, checkbutton, and scales.
> 
> Since it was so easy to modify, here's what i
> ended up with, all as just changes to the switch block:
> 
> (Sorry if this is not the proper way to suggest/share
> changes. But I was so thrilled with this new look
> I had to share it!)
> 
> in file libs/tree.tcl
> 
>             # @@change by Christian Gavin 3/5/2000
>             # added "checkbutton" and "radiobutton" classes
>             # added "entry" class
>             # added "message" class
>             # 3/15/2000 added generic proc for getting label
>                  # 5/18/2000 (et) added numerous other info texts by setting t
> 
>             switch $c {
>                 toplevel {set t [wm title $i]}
>                 frame {set t Frame}
>                 text {set t "Text Widget"}
>                 scrollbar {set t "Scrollbar"}
>                 scrollbar_h {set t "Horz Scrollbar"}
>                 scrollbar_v {set t "Vert Scrollbar"}
>                 canvas {set t "Canvas"}
>                 message        -
>                 menubutton {set t [$i cget -text]}
>                 entry {set t "-textvar [$i cget -textvariable]"}
>                 scale_h {set t "Hscale -var [$i cget -variable]"}
>                 scale_v {set t "Vscale -var [$i cget -variable]"}
>                                 label {
>                                         set ttt1 [$i cget -text]
>                                         set ttt2 [$i cget -textvariable]
>                                         if {$ttt2 == ""} {
>                                                 set t "LAB: $ttt1"
>                                         } else {
>                                                 set t "LAB: $ttt1 var=$ttt2"
>                                         }
> 
>                                 }
>                                 button {
>                                         set ttt1 [$i cget -text]
>                                         set ttt2 [$i cget -textvariable]
>                                         if {$ttt2 == ""} {
>                                                 set t "BUT: $ttt1"
>                                         } else {
>                                                 set t "BUT: $ttt1 var=$ttt2"
>                                         }
> 
>                                 }
>                                 radiobutton {
>                                         set ttt1 [$i cget -text]
>                                         set ttt2 [$i cget -variable]
>                                         set ttt3 [$i cget -value]
>                                         if {$ttt2 == ""} {
>                                                 set t "RB: $ttt1"
>                                         } else {
>                                                 set t "RB: $ttt1 
>var=$ttt2\(val=$ttt3\)"
>                                         }
> 
>                                 }
>                                 checkbutton {
>                                         set ttt1 [$i cget -text]
>                                         set ttt2 [$i cget -variable]
>                                         set ttt3 [$i cget -onvalue]
>                                         set ttt4 [$i cget -offvalue]
>                                         if {$ttt2 == ""} {
>                                                 set t "CB: $ttt1"
>                                         } else {
>                                                 set t "CB: $ttt1 
>var=$ttt2\(on=$ttt3,off=$ttt4\)"
>                                         }
> 
>                                 }
>                 default    {
>                         set t ""
>                         set tmpClass [string toupper [string range $c 0 0]]
>                         set tmpClass $tmpClass[string range $c 1 end]
> 
>                         if [info exists vTcl($tmpClass,get_widget_tree_label)] {
> 
>                                 set t [$vTcl($tmpClass,get_widget_tree_label) $c]
>                         }
>                 }
>             }
>             # @@end_change
> 
> _______________________________________________
> vtcl-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/mailman/listinfo/vtcl-user


_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/vtcl-user

Reply via email to