OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [demos/] [samples/] [STList1.tcl] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Tix Demostration Program
2
#
3
# This sample program is structured in such a way so that it can be
4
# executed from the Tix demo program "widget": it must have a
5
# procedure called "RunSample". It should also have the "if" statment
6
# at the end of this file so that it can be run as a standalone
7
# program using tixwish.
8
 
9
# Demonstrates the scrolled tlist widget
10
#
11
 
12
proc RunSample {w} {
13
    set top [frame $w.f -bd 1 -relief raised]
14
    set box [tixButtonBox $w.b -bd 1 -relief raised]
15
 
16
    pack $box -side bottom -fill both
17
    pack $top -side top -fill both -expand yes
18
 
19
    # Create the scrolled tlist
20
    #
21
    tixScrolledTList $top.st -options {
22
        tlist.orient vertical
23
        tlist.selectMode single
24
    }
25
    pack $top.st -expand yes -fill both -padx 10 -pady 10
26
 
27
    # Insert a list of numbers into the tlist subwidget
28
    #
29
    set tlist [$top.st subwidget tlist]
30
 
31
    set numbers {
32
        one two three fours five six seven eight nine ten eleven
33
        twelve thirdteen fourteen
34
    }
35
 
36
    foreach num $numbers {
37
        $tlist insert end -itemtype imagetext -text $num \
38
            -image [tix getimage openfold]
39
    }
40
 
41
    # Create the buttons
42
    #
43
    $box add ok     -text Ok     -command "destroy $w" -width 6
44
    $box add cancel -text Cancel -command "destroy $w" -width 6
45
}
46
 
47
if {![info exists tix_demo_running]} {
48
    wm withdraw .
49
    set w .demo
50
    toplevel $w
51
    RunSample $w
52
    bind $w <Destroy> exit
53
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.