|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc RunSample {w} { |
|
|
|
|
|
|
|
|
|
frame $w.top -relief raised -bd 1 |
|
|
|
|
|
|
|
|
|
tixScrolledHList $w.top.a -options { |
|
hlist.columns 3 |
|
hlist.header true |
|
} |
|
pack $w.top.a -expand yes -fill both -padx 10 -pady 10 -side left |
|
|
|
set hlist [$w.top.a subwidget hlist] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set style(header) [tixDisplayStyle text -refwindow $hlist \ |
|
-fg black -anchor c \ |
|
-padx 8 -pady 2\ |
|
-font [tix option get bold_font ]] |
|
|
|
$hlist header create 0 -itemtype text -text Name \ |
|
-style $style(header) |
|
$hlist header create 1 -itemtype text -text Position \ |
|
-style $style(header) |
|
|
|
|
|
|
|
|
|
|
|
|
|
$hlist column width 2 0 |
|
|
|
|
|
|
|
set boss {doe "John Doe" Director} |
|
|
|
set managers { |
|
{jeff "Jeff Waxman" Manager} |
|
{john "John Lee" Manager} |
|
{peter "Peter Kenson" Manager} |
|
} |
|
|
|
set employees { |
|
{alex john "Alex Kellman" Clerk} |
|
{alan john "Alan Adams" Clerk} |
|
{andy peter "Andreas Crawford" Salesman} |
|
{doug jeff "Douglas Bloom" Clerk} |
|
{jon peter "Jon Baraki" Salesman} |
|
{chris jeff "Chris Geoffrey" Clerk} |
|
{chuck jeff "Chuck McLean" Cleaner} |
|
} |
|
|
|
set style(mgr_name) [tixDisplayStyle text -refwindow $hlist \ |
|
-font [tix option get bold_font ]] |
|
set style(mgr_posn) [tixDisplayStyle text -refwindow $hlist \ |
|
-padx 8] |
|
|
|
set style(empl_name) [tixDisplayStyle text -refwindow $hlist \ |
|
-font [tix option get bold_font ]] |
|
set style(empl_posn) [tixDisplayStyle text -refwindow $hlist \ |
|
-padx 8 ] |
|
|
|
|
|
|
|
$hlist config -separator "." -width 25 -drawbranch 0 -indent 10 |
|
$hlist column width 0 -char 20 |
|
|
|
|
|
|
|
$hlist add . -itemtype text -text [lindex $boss 1] \ |
|
-style $style(mgr_name) |
|
$hlist item create . 1 -itemtype text -text [lindex $boss 2] \ |
|
-style $style(mgr_posn) |
|
|
|
|
|
|
|
set index 0 |
|
foreach line $managers { |
|
set row [$hlist add .[lindex $line 0] -itemtype text \ |
|
-text [lindex $line 1] -style $style(mgr_name)] |
|
$hlist item create $row 1 -itemtype text -text [lindex $line 2] \ |
|
-style $style(mgr_posn) |
|
incr index |
|
} |
|
|
|
foreach line $employees { |
|
|
|
|
|
set entrypath .[lindex $line 1].[lindex $line 0] |
|
|
|
|
|
|
|
set row [$hlist add $entrypath -text [lindex $line 2] \ |
|
-style $style(empl_name)] |
|
$hlist item create $row 1 -itemtype text -text [lindex $line 3] \ |
|
-style $style(empl_posn) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
tixButtonBox $w.box -orientation horizontal |
|
$w.box add ok -text Ok -underline 0 -command "destroy $w" \ |
|
-width 6 |
|
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \ |
|
-width 6 |
|
|
|
pack $w.box -side bottom -fill x |
|
pack $w.top -side top -fill both -expand yes |
|
} |
|
|
|
|
|
|
|
|
|
|
|
if {![info exists tix_demo_running]} { |
|
wm withdraw . |
|
set w .demo |
|
toplevel $w; wm transient $w "" |
|
RunSample $w |
|
bind .demo <Destroy> exit |
|
} |
|
|
|
|