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

Subversion Repositories or1k

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

Go to most recent revision | 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 Paned Window to contain two scrolled tlist's
20
    #
21
    set p [tixPanedWindow $top.p -orient horizontal]
22
    pack $p -expand yes -fill both -padx 4 -pady 4
23
 
24
    set p1 [$p add pane1 -expand 1]
25
    set p2 [$p add pane2 -expand 1]
26
 
27
    $p1 config -relief flat
28
    $p2 config -relief flat
29
 
30
    # Create a TList with vertical orientation
31
    #
32
    tixScrolledTList $p1.st -options {
33
        tlist.orient vertical
34
        tlist.selectMode single
35
    }
36
    label $p1.lab -text "Vertical Orientation"
37
 
38
    pack $p1.lab -anchor c -side top -pady 2
39
    pack $p1.st -expand yes -fill both -padx 10 -pady 10
40
 
41
    # Create a TList with horizontal orientation
42
    #   
43
    tixScrolledTList $p2.st -options {
44
        tlist.orient horizontal
45
        tlist.selectMode single
46
    }
47
    label $p2.lab -text "Horizontal Orientation"
48
 
49
    pack $p2.lab -anchor c -side top -pady 2
50
    pack $p2.st -expand yes -fill both -padx 10 -pady 10
51
 
52
    # Insert a list of numbers into the two tlist subwidget's
53
    #
54
    set vt [$p1.st subwidget tlist]
55
    set ht [$p2.st subwidget tlist]
56
 
57
    set numbers {
58
        one two three fours five six seven eight nine ten eleven
59
        twelve thirdteen fourteen
60
    }
61
 
62
    foreach num $numbers {
63
        $vt insert end -itemtype imagetext -text $num \
64
            -image [tix getimage openfold]
65
        $ht insert end -itemtype imagetext -text $num \
66
            -image [tix getimage openfold]
67
    }
68
 
69
    # Create the buttons
70
    #
71
    $box add ok     -text Ok     -command "destroy $w" -width 6
72
    $box add cancel -text Cancel -command "destroy $w" -width 6
73
}
74
 
75
if {![info exists tix_demo_running]} {
76
    wm withdraw .
77
    set w .demo
78
    toplevel $w
79
    RunSample $w
80
    bind $w <Destroy> exit
81
}

powered by: WebSVN 2.1.0

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