basegui - combobox - dgw - drawcanvas - hyperhelp - sbuttonbar - seditor - sfilebrowser - sfinddialog - sqlview - statusbar - tablelist - tlistbox - tvmixins

dgw::tablelist 0.2

Detlef Groth, Schwielowsee, Germany

2019-11-04

NAME

dgw::tablelist - extended tablelist widget with icons and tree mode implementation.

TABLE OF CONTENTS

SYNOPSIS

package require Tk
package require snit
package require dgw::tablelist
dgw::tablelist pathName ?options?
pathName configure -option value
pathName cget -option 
pathName loadFile filename ?boolean?

DESCRIPTION

The widget dgw::tablelist inherits from the standard tablelist widget all methods and options but has embedded standard icons. The treemode of tablelist is supported further with changing icons on opening and closing tree nodes.

COMMAND

dgw::tablelist pathName ?options?

Creates and configures the dgw::tablelist widget using the Tk window id pathName and the given options.

WIDGET OPTIONS

As the dgw::tablelist is an extension of the tablelist widget it has all the options of the tablelist widget. The following options are added or modified:

-browsecmd script

Set a command if the user double clicks an entry in the listbox or presses the Return key if the widget has the focus. The widget path and the index of the item getting the event are appended to the script call as function arguments. So the implementation of the script should have two arguments in the parameter list as shown in the following example:

  proc click {tbl idx} {
     puts [$tbl itemcget $idx -text]
  }
  dgw::tablelist .tl -browsecmd click

-collapsecommand command

This options is per default configured to change the icons in the tree for parent items which have child items if the node is opened. Can be overwritten by the user.

-collapseicon iconprefix

The imagw which should be displayed if a folder node is closed. Currently the default is a folder icon.

-expandcommand command

This options is per default configured to change the icons in the tree for parent items which have child items. Can be overwritten by the user.

-treestyle stylename

Currently this option is just delegated to the standard tablelist widget.

WIDGET COMMANDS

Each dgw::tablelist widget supports all the commands of the standard tablelist widget. See the tablelist manual page for a description of those widget commands.

EXAMPLE

proc click {tbl idx} {
     puts "clicked in $tbl on $idx"
}
dgw::tablelist .mtab   -columns {0 "Name"  left 0 "Page" left} \
       -movablecolumns no -setgrid no -treecolumn 0 -treestyle gtk -showlabels false \
       -stripebackground white -width 40 -height 25 \
       -browsecmd click

 pack .mtab -side left -fill both -expand yes
 dgw::tablelist .mtab2   -columns {0 "Name"  left 0 "Page" left} \
       -movablecolumns no -setgrid no -treecolumn 0 -treestyle ubuntu -showlabels false \
       -stripebackground grey90 -width 40 -height 25

 pack .mtab2 -side left -fill both -expand yes
 set x 0 
 while {[incr x] < 5} {
     set y 0
     set parent [.mtab insertchild root end [list Name$x $x]]
     set parent [.mtab2 insertchild root end [list Name$x $x]]        
     while {[incr y] < 5} {
         .mtab insertchild $parent end [list Child$y $y]
         .mtab2 insertchild $parent end [list Child$y $y]
     }
 }

INSTALLATION

Installation is easy you can install and use the dgw::tablelist package if you have a working install of:

For installation you copy the complete dgw folder into a path of your auto_path list of Tcl or you append the auto_path list with the parent dir of the dgw directory. Alternatively you can install the package as a Tcl module by creating a file dgw/tablelist-0.2.tm in your Tcl module path. The latter in many cases can be achieved by using the --install option of tablelist.tcl. Try "tclsh tablelist.tcl --install" for this purpose.

DEMO

Example code for this package can be executed by running this file using the following command line:

$ wish tablelist.tcl --demo

The example code used for this demo can be seen in the terminal by using the following command line:

$ wish tablelist.tcl --code

DOCUMENTATION

The script contains embedded the documentation in Markdown format. To extract the documentation you should use the following command line:

$ tclsh tablelist.tcl --markdown

This will extract the embedded manual pages in standard Markdown format. You can as well use this markdown output directly to create html pages for the documentation by using the --html flag.

$ tclsh tablelist.tcl --html

This will directly create a HTML page tablelist.html which contains the formatted documentation. Github-Markdown can be extracted by using the --man switch:

$ tclsh tablelist.tcl --man

The output of this command can be used to feed a markdown processor for conversion into a man page, html or pdf document. If you have pandoc installed for instance, you could execute the following commands:

# man page
tclsh tablelist.tcl --man | pandoc -s -f markdown -t man - > tablelist.n
# html 
tclsh tablelist.tcl --man > tablelist.md
pandoc -i tablelist.md -s -o tablelist.html
# pdf
pandoc -i tablelist.md -s -o tablelist.tex
pdflatex tablelist.tex

SEE ALSO

TODO

AUTHOR

The dgw::tablelist widget was written by Detlef Groth, Schwielowsee, Germany.

LICENSE

dgw::tablelist widget dgw::tablelist, version 0.2.

Copyright (c)

This library is free software; you can use, modify, and redistribute it for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions.

This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.