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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [tests/] [itcl/] [scope1.tcl] - Blame information for rev 1782

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
proc About {} {
2
    return "Testing creation of Tix widgets inside ITCL classes"
3
}
4
 
5
proc Test {} {
6
    class foo {
7
        inherit itk::Widget
8
 
9
        constructor {args} {
10
            itk_component add lab {
11
                label $itk_interior.lab \
12
                    -textvariable [code choice($this)]
13
            }
14
 
15
            itk_component add le {
16
                tixOptionMenu $itk_interior.le \
17
                    -label "File format" \
18
                    -variable [code choice($this)] \
19
                    -command "$this foocmd"
20
            }
21
 
22
            foreach cmd {HTML PostScript ASCII} {
23
                $itk_component(le) add command $cmd
24
            }
25
 
26
            pack $itk_component(lab) $itk_component(le) \
27
                -anchor e \
28
                -padx 10 \
29
                -pady 10 \
30
                -fill x
31
 
32
            eval itk_initialize $args
33
        }
34
        common choice
35
 
36
        method foocmd {args} {
37
            puts $args
38
        }
39
        method set_format {format} {
40
            set choice($this) $format
41
        }
42
    }
43
    usual TixOptionMenu {
44
    }
45
 
46
    foo .xy
47
    pack .xy
48
    .xy set_format ASCII
49
    update
50
    .xy component le config -value  PostScript
51
    update
52
    .xy component le config -value  HTML
53
}
54
 

powered by: WebSVN 2.1.0

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