Changeset 23399d1 in tol for tolbase


Ignore:
Timestamp:
Nov 17, 2016, 12:57:30 PM (10 years ago)
Author:
Pedro Gea <pgea@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
b23291d
Parents:
f861956
Message:

Refs #1933
Se suben cambios en blistboxplus para usar wtree en lugar de treeview.
Se adapta wtree para responder a algunos métodos de blistboxplus que se delegaban en treeview.
Pendiente aún de revisión.

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@7349 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tolbase/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tolbase/lib/byswidget/blistboxplus/blistboxplus.tcl

    rf861956 r23399d1  
    66
    77package require byscommon
    8 package require BLT
    98package require bfunctions
    109package require bfieldsdialog
    … …  
    6160
    6261  option -readonly  0
     62  option -selectmode  extended
    6363  option -keypress    true
    6464  option -colkeypress ""   
    … …  
    102102
    103103    if {0} {
    104       install _listbox using ::blt::treeview $win.lb -hideroot yes \
     104      return
     105      #@T install _listbox using ::blt::treeview $win.lb -hideroot yes \
    105106          -activeicons "" -icons {} -selectmode multiple \
    106107          -selectbackground grey -selectforeground white \
    … …  
    108109          -nofocusselectbackground grey -font {Arial 9} -flat yes
    109110    } else {
    110       set _listbox [::blt::treeview $win.lb -hideroot yes \
     111      set _listbox [::wtree $win.lb -table 0 -filter no \
     112        -background white -showroot 0 -selectmode extended -showheader 1 \
     113        -highlightbackground gray75 -highlightcolor black \
     114        -highlightthickness 0 -font {Arial 9} \
     115        -columns [::TolInspector::LNodeDef] ]
     116      #@T set _listbox [::blt::treeview $win.lb -hideroot yes \
    111117                        -activeicons "" -icons {} -selectmode multiple \
    112118                        -selectbackground grey -selectforeground white \
    … …  
    127133    bindtags $_listbox [linsert [bindtags $_listbox] 2 $win]
    128134
    129     $_listbox style  configure text     -bg white
    130 
    131     $_listbox column configure treeView -bg white
     135    #@T! $_listbox style  configure text     -bg white
     136    #@T! to do
     137
     138    #@T! $_listbox column configure treeView -bg white
     139    #@T! to do   
    132140
    133141    $self configure -readonly [from args -readonly]
    … …  
    137145    $self configurelist $args
    138146
    139     $_listbox configure -xscrollcommand "$xbar set"
    140     $_listbox configure -yscrollcommand "$ybar set"
     147    #@T! $_listbox configure -xscrollcommand "$xbar set"
     148    #@T! $_listbox configure -yscrollcommand "$ybar set"
     149    #@T! to do   
    141150    if { $options(-parent) eq "" } {
    142151      $self configure -parent [winfo parent $win]
    … …  
    144153   
    145154    # bind
    146     $_listbox bind all <KeyPress> +[list $self _OnKeyPress %A]
     155    #@T! $_listbox bind all <KeyPress> +[list $self _OnKeyPress %A]
     156    #@T! to do   
    147157   
    148158    $self configure -nomenu [from args -nomenu]
    … …  
    176186    catch [list $self _WriteIni ]
    177187  }
    178    
     188
    179189  #///////////////////////////////////////////////////////////////////////////
    180190  #
    … …  
    183193  #///////////////////////////////////////////////////////////////////////////
    184194
    185     onconfigure -cols { lst } {
    186      set options(-cols) $lst
    187        foreach col [$self column names] {
    188          $_listbox column delete $col
    189        }
    190        foreach col $options(-cols) {
    191          $_listbox column insert end $col -justify left
    192          $_listbox column configure $col -command "$self _SortByColumn [list $col]" \
    193             -titleborderwidth 1
    194        }
    195        if { $options(-icon) == "" } {
    196          $_listbox column configure "BLT TreeView $_listbox" -hide 1
    197        } else {
    198          $_lisbox column configure "BLT TreeView $_listbox" -hide 0
    199        }
     195  onconfigure -cols { lst } {
     196    set options(-cols) $lst
     197    #@T! foreach col [$self column names] {
     198    #@T!   $_listbox column delete $col
     199    #@T! }
     200    $_listbox column delete all
     201    #@T! foreach col $options(-cols) {
     202    #@T!   $_listbox column insert end $col -justify left
     203    #@T!   $_listbox column configure $col -command "$self _SortByColumn [list $col]" -titleborderwidth 1
     204    #@T! }
     205   
     206    set lstx [list [list image -label Icon -tags Icon] ]
     207    foreach col $lst {
     208      set colx [list text -label $col -tags $col]
     209      lappend lstx $colx
     210    }
     211    Tolcon_Trace "lstx $lstx"
     212    $_listbox configure -columns $lstx
     213   
     214    if { $options(-icon) == "" } {
     215      #@T! $_listbox column configure "BLT TreeView $_listbox" -hide 1
     216      $_listbox column configure Icon -visible 0
     217    } else {
     218      #@T! $_listbox column configure "BLT TreeView $_listbox" -hide 0
     219      $_listbox column configure Icon -visible 1
     220    }
     221   
     222    #@T adds
     223    $_listbox column configure first -expand yes -weight 1
     224    $_listbox column configure all -itembackground ""   
    200225  }
    201226
    … …  
    204229    foreach col [$self column names] {
    205230      if { "-1" eq [lsearch $options(-hiddencols) $col] } {
    206         $_listbox column configure $col -hide 0
     231        #@T! $_listbox column configure $col -hide 0
     232        $_listbox column configure $col -visible 1
    207233      } else {
    208         $_listbox column configure $col -hide 1
     234        #@T! $_listbox column configure $col -hide 1
     235        $_listbox column configure $col -visible 0
    209236      }
    210237    }
    … …  
    220247    set options(-icon) $icon
    221248    if { $icon != "" } {
    222       $_listbox column configure "BLT TreeView $_listbox" -min 16 -max 16 \
    223         -hide 0 -titleborderwidth 1
    224       $_listbox configure -icons [list [Bitmap::get $icon] [Bitmap::get $icon]]
     249      #@T! $_listbox column configure "BLT TreeView $_listbox" -min 16 -max 16 \
     250      #@T!   -hide 0 -titleborderwidth 1
     251      #@T! $_listbox configure -icons [list [Bitmap::get $icon] [Bitmap::get $icon]]
     252      $_listbox column configure Icon -minwidth 16 -maxwidth 16 -visible 1 ;# -titleborderwidth 1
     253     
    225254    } else {
    226       $_listbox column configure "BLT TreeView $_listbox" -hide 1
     255      #@T! $_listbox column configure "BLT TreeView $_listbox" -hide 1
     256      $_listbox column configure Icon -visible 0
    227257    }
    228258  }
    … …  
    237267    }
    238268  }
    239  
     269
    240270  onconfigure -values { lst } {
    241271    $self clear
    … …  
    253283    }
    254284  }
    255  
     285
    256286  onconfigure -readonly { bool } {
    257287    if {!($created)} {
    … …  
    263293  }
    264294 
     295  onconfigure -selectmode { mode } {
     296    if { $mode eq "multiple" } {
     297      set options(-selectmode) "extended"
     298    } else {
     299      set options(-selectmode) $mode
     300    }
     301  } 
     302
    265303  onconfigure -filtercols { lst } {
    266304    set cols [$self cget -cols]   
    … …  
    280318    }
    281319  }
    282  
     320
    283321  #///////////////////////////////////////////////////////////////////////////
    284322  method _CreateMenu {args} {
    … …  
    334372    }
    335373    # bindings   
    336     $self bind all <Control-KeyRelease> +[list $self _OnControlKey $self %K %k]
    337     $self bind all <Key-Delete>    "lbDeleteSelection $self"
    338     $self bind all <Key-Insert>    "$self _OpenWR"   
    339     $self bind all <Shift-Up>      "$self addPrevious"
    340     $self bind all <Shift-Down>    "$self addNext"
    341     $self bind all <Up>            "$self previous"
    342     $self bind all <Down>          "$self next"
    343     $self bind all <Home>          "$self first"
    344     $self bind all <End>           "$self last"
    345     $self bind all <Shift-Home>    "$self addAllPrevious"
    346     $self bind all <Shift-End>     "$self addAllNext"
    347     $self bind all <Button-1>      +[list focus -force %W]
    348   }
    349 
    350 
     374    #@T $self bind all <Control-KeyRelease> +[list $self _OnControlKey $self %K %k]
     375    #@T $self bind all <Key-Delete>    "lbDeleteSelection $self"
     376    #@T $self bind all <Key-Insert>    "$self _OpenWR"   
     377    #@T $self bind all <Shift-Up>      "$self addPrevious"
     378    #@T $self bind all <Shift-Down>    "$self addNext"
     379    #@T $self bind all <Up>            "$self previous"
     380    #@T $self bind all <Down>          "$self next"
     381    #@T $self bind all <Home>          "$self first"
     382    #@T $self bind all <End>           "$self last"
     383    #@T $self bind all <Shift-Home>    "$self addAllPrevious"
     384    #@T $self bind all <Shift-End>     "$self addAllNext"
     385    #@T $self bind all <Button-1>      +[list focus -force %W]
     386   
     387    bind $_listbox.frameTree.t <Control-KeyRelease> +[list $self _OnControlKey $self %K %k]
     388    bind $_listbox.frameTree.t <Key-Delete>    "lbDeleteSelection $self"
     389    bind $_listbox.frameTree.t <Key-Insert>    "$self _OpenWR"   
     390    bind $_listbox.frameTree.t <Shift-Up>      "$self addPrevious"
     391    bind $_listbox.frameTree.t <Shift-Down>    "$self addNext"
     392    bind $_listbox.frameTree.t <Up>            "$self previous"
     393    bind $_listbox.frameTree.t <Down>          "$self next"
     394    bind $_listbox.frameTree.t <Home>          "$self first"
     395    bind $_listbox.frameTree.t <End>           "$self last"
     396    bind $_listbox.frameTree.t <Shift-Home>    "$self addAllPrevious"
     397    bind $_listbox.frameTree.t <Shift-End>     "$self addAllNext"
     398    bind $_listbox.frameTree.t <Button-1>      +[list focus -force %W]   
     399  }
     400
     401  #@//////////////////////////////////////////////////////////////////////////
     402  method bind { args } {
     403  #
     404  # PURPOSE: modifies a particular case of bind
     405  #
     406  #///////////////////////////////////////////////////////////////////////////
     407    if { [lindex $args 1] eq "<Selection>" } {
     408      #@T no se usa
     409      return [eval $_listbox notify bind $args]
     410    } else {
     411      return [bind $_listbox.frameTree.t [lindex $args 1] [lindex $args 2]]
     412    }
     413  }
     414   
     415  method curselection {} {
     416    set cursel [$_listbox selection get]
     417    if { [expr [llength $cursel] <= 1] } { return $cursel }
     418    set curselx {}
     419    foreach it $cursel {
     420      lappend curselx [list $it [$_listbox item order $it]]
     421    } 
     422    set curselxs [lsort -index end $curselx]
     423    set cursels {}
     424    foreach it $curselxs {
     425      lappend cursels [lindex $it 0]
     426    }
     427    return $cursels
     428   
     429    #set firstPos [$_listbox item order [lindex $cursel 0]]
     430    #set lastPos [$_listbox item order [lindex $cursel end]]
     431    #if { [expr $firstPos <= $lastPos] } {
     432    #  Tolcon_Trace "right!"
     433    #  foreach it $cursel {
     434    #    Tolcon_Trace "$it [$_listbox item order $it]"
     435    #  }
     436    #  return $cursel
     437    #} else {
     438    #  Tolcon_Trace "reversed!"
     439    #  foreach it $cursel {
     440    #    Tolcon_Trace "$it [$_listbox item order $it]"
     441    #  }   
     442    #  return [lreverse $cursel]
     443    #}
     444  }
     445     
    351446  #///////////////////////////////////////////////////////////////////////////
    352447  method getMenu { } {
    … …  
    360455    return $menu
    361456  }
    362 
    363457
    364458  #///////////////////////////////////////////////////////////////////////////
    … …  
    379473    }
    380474  }
    381 
    382475
    383476  #///////////////////////////////////////////////////////////////////////////
    … …  
    427520  }
    428521
    429 
    430522  #/////////////////////////////////////////////////////////////////////////////
    431523  method _ToggleSelection {} {
    … …  
    439531  }
    440532
    441 
    442533  #///////////////////////////////////////////////////////////////////////////
    443534  method _SelectAll { } {
    … …  
    450541    }
    451542  }
    452 
    453543
    454544  #/////////////////////////////////////////////////////////////////////////////
    … …  
    483573  }
    484574
    485 
    486575  #/////////////////////////////////////////////////////////////////////////////
    487576  method _SaveToFile {se unSe {pref ""} {suf ""} {sep "\n"}} {
    … …  
    506595      if { ![ catch { set fd [open $filNam w] } msgerr] } {
    507596        # text to save
    508         set lst {}
    509         if { $se } {
    510           foreach i [$self selection get selected] {
    511             lappend lst [$self get $i]
    512           }
    513         }
    514         if { $unSe } {
    515           foreach i [$self selection get unselected] {
    516             lappend lst [$self get $i]
    517           }
    518         }
    519         set str [ListToStr $lst $sep $pref $suf]
    520         # write
    521         puts -nonewline $fd $str
    522         close $fd
    523         return 1
     597        set lst {}
     598        if { $se } {
     599          foreach i [$self selection get selected] {
     600            lappend lst [$self get $i]
     601          }
     602        }
     603        if { $unSe } {
     604          foreach i [$self selection get unselected] {
     605            lappend lst [$self get $i]
     606          }
     607        }
     608        set str [ListToStr $lst $sep $pref $suf]
     609        # write
     610        puts -nonewline $fd $str
     611        close $fd
     612        return 1
    524613      }
    525614      error $msgerr
    … …  
    542631      if { ![ catch { set fd [open $filNam r] } msgerr] } {
    543632         while { [gets $fd line ] >= 0} {
    544                    Tolcon_Trace "adding $line"
     633           Tolcon_Trace "adding $line"
    545634           $self add $line
    546635         }
    … …  
    561650  #///////////////////////////////////////////////////////////////////////////
    562651
    563         set numofel [$self size]
    564         set lst [list]
    565         set fulllst [$self get]
    566 
    567         foreach i $fulllst {
    568            lappend lst [$self get $i ]
     652    set numofel [$self size]
     653    set lst [list]
     654    set fulllst [$self get]
     655
     656    foreach i $fulllst {
     657      lappend lst [$self get $i ]
    569658    }
    570659# lst:    contains a list of values
    571         set coln 0
    572         set cols [$self cget -cols]
    573         set hidcols [$self cget -hiddencols]
    574         for { set j 0 } { $j < [llength $cols] } { incr j } {
    575                 if {[lindex $cols $j] eq $col} {
    576                         set coln $j
    577                 }
    578         }
     660    set coln 0
     661    set cols [$self cget -cols]
     662    set hidcols [$self cget -hiddencols]
     663    for { set j 0 } { $j < [llength $cols] } { incr j } {
     664      if {[lindex $cols $j] eq $col} {
     665        set coln $j
     666      }
     667    }
    579668# coln:   contains the index of the column to be ordered
    580         set lst [lsort -index $coln $lst]
    581         $self clear
     669    set lst [lsort -index $coln $lst]
     670    $self clear
    582671    for { set i 0 } { $i < $numofel } { incr i } {
    583         set el [lindex $lst $i ]
    584                 $self insert end $el
    585     }
    586 
    587   }
    588 
     672      set el [lindex $lst $i ]
     673      $self insert end $el
     674    }
     675
     676  }
    589677
    590678  #///////////////////////////////////////////////////////////////////////////
    … …  
    602690    }
    603691  }
    604 
    605692
    606693  #//////////////////////////////////////////////////////////////////////////
    … …  
    633720    $dialog draw
    634721  }
    635  
    636  
     722
    637723  #///////////////////////////////////////////////////////////////////////////
    638724  proc _Filter { elem father } {
    … …  
    647733    eval $father filter $elem
    648734  }
    649 
    650735
    651736  #//////////////////////////////////////////////////////////////////////////
    … …  
    660745                -parent $self -orientation $options(-orientation) \
    661746                -fields $options(-filtercols) -procedure [codename _Filter] \
    662                 -buttons { info apply accept cancel } \
     747                -buttons { info apply accept cancel } \
    663748                -titles $options(-titles)]
    664749    $dialog configure -info \
    … …  
    703788    $dialog draw
    704789  }
    705  
     790
    706791  #///////////////////////////////////////////////////////////////////////////
    707792  method _WriteIni { } {
    … …  
    748833  }
    749834
    750 
    751835  #///////////////////////////////////////////////////////////////////////////
    752836  method selection { args } {
    … …  
    759843  #///////////////////////////////////////////////////////////////////////////
    760844    if { [lindex $args 0] eq "get" } {
    761      if { [lindex $args 1] eq "unselected" } {
    762        set result {}
    763        set selected [$self curselection]
    764        foreach i [$self get] {
    765          if { "-1" eq [lsearch $selected $i] } {
    766            lappend result $i
    767         }
    768        }
    769        return $result
    770      } else {
    771       return [eval $_listbox curselection]
    772      }
    773     }
    774 
     845      if { [lindex $args 1] eq "unselected" } {
     846        set result {}
     847        set selected [$self curselection]
     848        foreach i [$self get] {
     849          if { "-1" eq [lsearch $selected $i] } {
     850            lappend result $i
     851          }
     852        }
     853        return $result
     854      } else {
     855        #@T! return [eval $_listbox curselection]
     856        return [$self curselection]
     857      }
     858    }
    775859    eval $_listbox selection $args
    776860  }
    777 
    778861
    779862  #///////////////////////////////////////////////////////////////////////////
    … …  
    787870  #
    788871  #///////////////////////////////////////////////////////////////////////////   
     872    Tolcon_Trace "insert pos: $pos args: $args"
    789873    if { [lindex $args 0] eq "cols" } {
    790874      set cols [lindex $args 1]
    … …  
    796880    switch [llength $cols] {
    797881      1 {
    798         # mas de una columna
     882        # una sola columna
    799883        foreach dats $args {
    800884          set datos [list [lindex $cols 0] $dats]
    801           $_listbox insert $pos $currentId -data $datos
     885          #@T! $_listbox insert $pos $currentId -data $datos
     886          set node [$_listbox item create -parent root -button 0 -open 0]
     887          eval $_listbox item text $node $datos
     888          if { $options(-icon) != "" } {
     889            $_listbox item image $node [Bitmap::get $options(-icon)]
     890          }         
    802891          incr currentId
    803892        }       
    … …  
    810899          foreach col $cols {
    811900            lappend datos $col [lindex $dats $i]
    812             incr i
     901            incr i
     902          }
     903          #@T! $_listbox insert $pos $currentId -data $datos
     904          set node [$_listbox item create -parent root -button 0 -open 0] ;# -parent $pos
     905          eval $_listbox item text $node $datos
     906          if { $options(-icon) != "" } {
     907            $_listbox item image $node [Bitmap::get $options(-icon)]
    813908          }
    814           $_listbox insert $pos $currentId -data $datos
    815909          incr currentId
    816910        }
    … …  
    818912    }
    819913  }
    820 
    821914
    822915  #///////////////////////////////////////////////////////////////////////////
    … …  
    832925    eval $self insert end $args
    833926  }
    834  
    835927
    836928  #///////////////////////////////////////////////////////////////////////////
    … …  
    845937  #///////////////////////////////////////////////////////////////////////////
    846938    if { "-1" eq [lsearch $args 0] } {
    847       eval $_listbox delete $args
     939      #@T! eval $_listbox delete $args
     940      eval $_listbox item delete $args
    848941    } else {
    849942      puts "Root node can't be deleted"
    850943    }
    851944  }
    852  
    853  
     945
    854946  #/////////////////////////////////////////////////////////////////////////// 
    855947  method getlb {} {
    … …  
    860952    return $_listbox
    861953  }
    862 
    863954
    864955  #///////////////////////////////////////////////////////////////////////////
    … …  
    872963  #
    873964  #///////////////////////////////////////////////////////////////////////////
    874     if { $ids eq "" } { return [lrange [$self find] 1 end] }
     965    Tolcon_Trace "get ids: $ids cols: $cols"
     966    if { $ids eq "" } {
     967      #@T! return [lrange [$self find] 1 end]
     968      set items [$_listbox item children root]
     969      Tolcon_Trace "items $items"
     970      return $items  ;#??
     971    }
    875972 
    876973    set result {}
    877          
    878         if { "$cols" eq "" } {
    879           set cols [$self column names]
    880         }
     974 
     975    if { "$cols" eq "" } {
     976      set cols [$self column names]
     977    }
    881978
    882979    foreach id $ids {
    … …  
    884981      set elem {}
    885982   
    886       set data [$_listbox entry cget $id -data]   
    887    
     983      #@T! set data [$_listbox entry cget $id -data]   
     984      #@T! foreach col $cols {
     985      #@T!   set inx [lsearch $data $col]
     986      #@T!   if { "-1" ne $inx } {
     987      #@T!     incr inx
     988      #@T!     lappend elem [lindex $data $inx]
     989      #@T!   }
     990      #@T! }
     991     
    888992      foreach col $cols {
    889         set inx [lsearch $data $col]
    890         if { "-1" ne $inx } {
    891           incr inx
    892           lappend elem [lindex $data $inx]
    893         }
     993        lappend elem [$_listbox item text $id $col]
    894994      }
    895995     
    896996      lappend result $elem
    897997    }
    898     if { [llength $ids] eq 1 } { return [lindex $result 0] }
     998     
     999    if { [llength $ids] eq 1 } {
     1000      Tolcon_Trace "get result: $result"
     1001      Tolcon_Trace "get result0: [lindex $result 0]"       
     1002      return [lindex $result 0]
     1003    }
     1004    Tolcon_Trace "get result: $result"   
    8991005    return $result
    9001006  }
    901 
    9021007
    9031008  #///////////////////////////////////////////////////////////////////////////
    … …  
    9121017  #
    9131018  #///////////////////////////////////////////////////////////////////////////
     1019    Tolcon_Trace "set id: $id data: $data cols: $cols"
    9141020    if { "$cols" eq "" } {
    9151021      set cols [$self column names]
    … …  
    9221028      incr i
    9231029    }
    924     return [$_listbox entry configure $id -data $datos]
    925   }
    926 
     1030    #@T! return [$_listbox entry configure $id -data $datos]
     1031    return [eval $_listbox item text $id $datos]
     1032  }
    9271033
    9281034  #///////////////////////////////////////////////////////////////////////////
    … …  
    9461052    return [lindex $all 0]
    9471053  }
    948    
    949    
     1054
    9501055  #///////////////////////////////////////////////////////////////////////////
    9511056  method last {} {
    … …  
    9681073    return [lindex $all [expr [llength $all] - 1]]           
    9691074  }
    970 
    9711075
    9721076  #///////////////////////////////////////////////////////////////////////////
    … …  
    9961100    }
    9971101  }
    998  
    9991102
    10001103  #///////////////////////////////////////////////////////////////////////////
    … …  
    10241127  }
    10251128
    1026 
    10271129  #///////////////////////////////////////////////////////////////////////////
    10281130  method previous {} {
    … …  
    10541156    }
    10551157  }
    1056    
    10571158
    10581159  #///////////////////////////////////////////////////////////////////////////
    … …  
    10851186    }
    10861187  }
    1087    
    10881188
    10891189  #///////////////////////////////////////////////////////////////////////////
    … …  
    11151215    }
    11161216  }
    1117    
    11181217
    11191218  #///////////////////////////////////////////////////////////////////////////
    … …  
    11421241    }
    11431242  }
    1144    
    11451243
    11461244  #///////////////////////////////////////////////////////////////////////////
    … …  
    11561254  }
    11571255
    1158 
    11591256  #///////////////////////////////////////////////////////////////////////////
    11601257  method size {} {
    … …  
    11661263  }
    11671264
    1168 
    11691265  #///////////////////////////////////////////////////////////////////////////
    11701266  method column { args } {
    … …  
    11731269  #
    11741270  #///////////////////////////////////////////////////////////////////////////
     1271    #@T! if { [lindex $args 0] eq "names" } {
     1272    #@T!   return [lrange [$_listbox column names] 1 end]
     1273    #@T! }
     1274    #@T! return [eval $_listbox column $args]
    11751275    if { [lindex $args 0] eq "names" } {
    1176       return [lrange [$_listbox column names] 1 end]
    1177     }
    1178     return [eval $_listbox column $args]
    1179   }
    1180  
     1276      set names {}
     1277      foreach col [lrange [$_listbox column list] 1 end] {
     1278        lappend names [$_listbox column tag names $col]
     1279      }
     1280      return $names
     1281    }
     1282    return [eval $_listbox column id $args]   
     1283  }
    11811284
    11821285  #///////////////////////////////////////////////////////////////////////////
    … …  
    12331336      -icons [list [Bitmap::get $icon] [Bitmap::get $icon]]
    12341337  }
    1235        
     1338
    12361339  # delegacion de metodos y opciones
    12371340  delegate method * to _listbox
    … …  
    13211424    .top.f1.f.blb clear
    13221425    .top.f1.f.blb insert end {1 2 3 4} {one two three four} \
    1323           {uno dos tres cuatro} {k kk kkk kkkk} {0 0 0 0} {@ # $ %}
     1426      {uno dos tres cuatro} {k kk kkk kkkk} {0 0 0 0} {@ # $ %}
    13241427  }
    13251428 
    13261429  proc toggleSelectModeCmd {} {
    13271430    if { [.top.f1.f.blb cget -selectmode] eq "multiple" } {
    1328           .top.f1.f.blb configure -selectmode single
     1431      .top.f1.f.blb configure -selectmode single
    13291432    } else {
    1330           .top.f1.f.blb configure -selectmode multiple
     1433      .top.f1.f.blb configure -selectmode multiple
    13311434    }
    13321435  }
  • tolbase/lib/wtree/wtree.tcl

    rf861956 r23399d1  
    718718  #    orden en que se describen los elementos de la columna.
    719719  #
     720
    720721  method _conf-columns { _ columnsSpec } {
    721722    if { $columnsSpec eq "" } {
    … …  
    826827  }
    827828
     829  method find { {first first} {last last} } {
     830    if { [string match "-*" $first] } {
     831      error "no flags allowed!"
     832    } else {
     833      return [$tree item range $first $last]
     834    }
     835  }
     836 
     837  method selection { args } {
     838    if { [lindex $args 0] eq "set" } {
     839      Tolcon_Trace "selection $args"
     840      switch [llength $args] {
     841        1 { $tree selection clear all }
     842        2 { $tree selection modify [lindex $args 1] all }
     843        3 { $tree selection modify [$tree item range [lindex $args 1] [lindex $args 2]] all }
     844        default {
     845          error "invalid number of arguments"       
     846        }       
     847      }
     848    } elseif { [lindex $args 0] eq "clearall" } {
     849      $tree selection clear all
     850    }  {
     851      eval $tree selection $args
     852    } 
     853  }
     854 
     855  method index { args } {
     856    error "invalid method index"
     857  }
     858 
     859  method move { item how dest } {
     860    Tolcon_Trace "item: $item how: $how dest: $dest"
     861    if { $item eq $dest } { return }
     862    switch $how {
     863      into {
     864        $tree item lastchild $dest $item
     865      }
     866      after {
     867        if { $dest eq "" } {
     868          $tree item prevsibling $item [$tree item nextsibling $item]
     869        } else {
     870          $tree item nextsibling $dest $item
     871          #$tree item prevsibling $item $dest
     872        }
     873      }
     874      before {
     875        if { $dest eq "" } {
     876          $tree item nextsibling $item [$tree item prevsibling $item]
     877        } else {
     878          $tree item prevsibling $dest $item
     879          #$tree item nextsibling $item $dest
     880        }
     881      }
     882      default {
     883        error "invalid argument 'how', should be: into (child), before or after"
     884      }
     885    }
     886  } 
     887 
    828888  method insert { data args } {
    829889    array set insopt {
Note: See TracChangeset for help on using the changeset viewer.