## columnctrl.tcl ## ## columnctrl.tcl - interactive control of tablelist 's columns. ## ## Columnctrl is an add-on for the tablelist package. ## Columnctrl provides an interactive control of tablelist's columns. ## With this control, user can show/hide columns, ## as well as change columns order. ## Columnctrl comes with Multi-lingual support, providing messages ## based on the current-locale. (currently only "english" and "italian") ## Columnctrl supports the tile theme-engine: ## If the 'attached' tablelist is tile-based, then also the columnctrl's ## user-interface will be tile-based. VERSION: -------- columnctrl - 1.1.1 (see history.txt for changes) REQUIRED PACKAGES: ------------------ tablelist - v.3.5 or higher http//www.nemethi.de scrodget - v.2.1 or higher (* see note*) http://webspace.tiscali.it/irrational/tcl/scrodget2.1/index.html snit - v.0.97 or higher http://www.wjduquette.com/snit IMPORTANT NOTE --------------- All the required packages should have been installed under standard library path. Since Scrodget is not a so-standard package, this package comes with a copy of scrodget. You don't need to install scrodget for running the demos, but if you want to use columnctrl in your apps, you need to install it under a standard library place HOW TO USE IT ------------- Included demos will show you how to add a column-control to your applications. Basically, in order to activate a column-control you only need to add 2 lines: package require Tablelist::ColumnCtrl tablelist::columnctrl::attach $tbl # NOTE: replace $tbl with the name of your tablelist There are few other command you can use for customizing, and removing the column-control (read below). NOTE that you should observe two simple rules: Rule I) all columns should have a unique name. Rule II) be careful when inserting values in a tablelist whose columns might have been reorderd. This latter rule may require a little explanation: When inserting values in a tablelist's row, you cannot assume a fixed columns *position*; inserting values in a row should always be carried based on columns' *names* . In general you should always follow this rule when you allow 'movablecolumns", independently of the usage of 'column-control'. Columnctrl is simply a user-friendly way to move, show/hide columns, nothing more. Just for clarification, let's read the following example: # table $tbl has three columns "Fruit" "Nation" "Animal" tablelist $tbl $tbl insertcolumns end 0 "Fruit" center $tbl columnconfigure end -name fruit $tbl insertcolumns end 0 "Nation" center $tbl columnconfigure end -name nation $tbl insertcolumns end 0 "Animal" center $tbl columnconfigure end -name animal # $tbl has movablecolumns $tbl configure -movablecolumns true # Now, IF columns position has not changed, # you can add a row with a simple command like: $tbl insert 0 { "Mango" "Kenya" "Lion" } # BUT, if columns have been reordered you cannot use # the above command; you should use something like: $tbl insert 0 {} $tbl cellconfigure 0,fruit "Mango" $tbl cellconfigure 0,nation "Kenya"... $tbl cellconfigure 0,animal "Lion" COMMANDS ======== package require Tablelist::ColumnCtrl tablelist::columnctrl::attach $tbl Attach a column-control to tablelist $tbl Note that when you destroy $tbl, the column-control (and all the associated data) will be automatically destroyed. Note that you can reorder the columns only if $tbl allows movable columns. tablelist::columnctrl::detach $tbl Remove the column-control and delete the associated data. tablelist::columnctrl::configure $tbl -neverhide { colID ... } Never allow to hide columns { colID ... } By default, user can hide all the columns. tablelist::columnctrl::configure $tbl -nevershow { colID ... } Never allow to show columns { colID ... } By default, the popup-list (or the detail panel) will list all the columns. tablelist::columnctrl::controlButton $tbl Return the path of the button widget attached to $tbl. This command can be used for changing the look&feel of the button. tablelist::columnctrl::controlMenu $tbl Return the path of the menu widget attached to $tbl. This command can be used for changing the look&feel of the menu. == DEMOS == read "demo/README.txt"