| Itcl  | Itk  | Itcl @ Wiki  | Itcl @ SF  | Tcl  | Tcl @ Wiki |
  home || iwidgets || man pages cross ref distribution docs faq  
buttonbox
calendar
canvasprintbox
canvasprintdialog
checkbox
combobox
dateentry
datefield
dialog
dialogshell
disjointlistbox
entryfield
extbutton
extfileselectionbox
extfileselectiondialog
feedback
fileselectionbox
fileselectiondialog
finddialog
hierarchy
hyperhelp
labeledframe
labeledwidget
mainwindow
menubar
messagebox
messagedialog
notebook
optionmenu
panedwindow
promptdialog
pushbutton
radiobox
regexpfield
scrolledcanvas
scrolledframe
scrolledhtml
scrolledlistbox
scrolledtext
scrolledwidget
selectionbox
selectiondialog
shell
spindate
spinint
spinner
spintime
tabnotebook
tabset
timeentry
timefield
toolbar
watch

man page | options | methods

Hierarchy

The hierarchy iwidget is used as a hierarchical data viewer for tasks that involve tree type relationships, such as directory structures. If a node has nodes under it, then this can be expanded and collapsed by clicking on the icon of the node, or by invoking the expand and collapse public methods. The -querycommnd option specifies the command to invoke to expand a node. There are other methods that let you distinguish nodes from others such as the selection and mark public methods. The iwidget comes with scrollbars, so the programmer can control the scrollbars through the usual scrolledwidget mechanisms (i.e. -hscrollmode). The iwidget comes with built in icons for the nodes, but the programmer can also specify other icons to replace the default ones. For further information, see the Hierarchy manpage

Components: bgMenu clipper horizsb hull itemMenu label list vertsb
				

wm title . "Hierarchy Example"

##
##  Initialize some data
##
set nodes(start) [list a_node b_node c_node d_node e_node]
set nodes(a_node) [list a1 a2 a3 a4]
set nodes(b_node) [list b1 b2 b3 b4]
set nodes(c_node) [list c1 c2 c3 c4]
set nodes(d_node) [list d1 d2 d3 d4]
set nodes(e_node) [list e1 e2 e3 e4]

image create photo rb -file redball.gif
image create photo gb -file greenball.gif
image create photo tcl -file tcl_logo_small.gif

##
##  Supporting procedure for the
##  -querycommand option
##
proc show {n} {

  global nodes

  expr {($n == "") ? [set N start] : [set N $n]}

  if ![info exists nodes($N)] {

    return
  }

  return $nodes($N)

}; # end proc show


##=========================================================
##  Create a Hierarchy iwidget
##=========================================================
##
iwidgets::hierarchy .h \
 -querycommand {show %n} \
 -visibleitems 25x14 \
 -labeltext "Hierarchy Example" \
 -markbackground gray \
 -selectbackground yellow \
 -closedicon rb \
 -openicon gb \
 -nodeicon tcl \
 -textbackground white

pack .h \
  -fill both \
  -expand true


##
##  Need to do this so the following methods
##  act after everything has been drawn
##
update idletasks

##
##  Expand, mark, and select
##  some of the nodes
##
.h expand b_node
.h selection add a_node
.h mark add e_node

Download this sample code
man page | options | methods
 
  home || iwidgets || man pages cross ref distribution docs faq  
Copyright | Contributions | Development Team | Credits
Bugs/Comments/Suggestions about this web site