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

Subversion Repositories or1k

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

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
# This file demonstrates the use of the tixLabelFrame widget -- a frame that
10
# come with a label at its side. It looks nifty when you use the set the
11
# -labelside option to "acrosstop". Note that a lot of Tix widgets, such
12
# as tixComboBox or tixControl, have the -labelside and -label options. So
13
# you can use these options to achieve the same effect as in this file
14
#
15
 
16
proc RunSample {w} {
17
 
18
    # Create the radiobuttons at the top of the dialog box, put them
19
    # inside two tixLabelFrames:
20
    #
21
    frame $w.top -border 1 -relief raised
22
 
23
    tixLabelFrame $w.top.a -label Font: -labelside acrosstop -options {
24
        label.padX 5
25
    }
26
    tixLabelFrame $w.top.b -label Size: -labelside acrosstop -options {
27
        label.padX 5
28
    }
29
 
30
    pack $w.top.a $w.top.b  -side left -expand yes -fill both
31
 
32
    # Create the radiobuttons inside the left frame.
33
    #
34
    # [Hint] You *must* create the new widgets inside the "frame"
35
    #        subwidget, *not* as immediate children of $w.top.a!
36
    #
37
    set f [$w.top.a subwidget frame]
38
    foreach color {Red Green Blue Yellow Orange Purple} {
39
        set lower [string tolower $color]
40
        radiobutton $f.$lower -text $color -variable demo_color \
41
            -relief flat -value $lower -bd 2 -pady 0 -width 7 -anchor w
42
        pack $f.$lower -side top -pady 0 -anchor w -padx 6
43
    }
44
 
45
    # Create the radiobuttons inside the right frame.
46
    #
47
    set f [$w.top.b subwidget frame]
48
    foreach point {8 10 12 14 18 24} {
49
        set lower [string tolower $point]
50
        radiobutton $f.$lower -text $point -variable demo_point \
51
            -relief flat -value $lower -bd 2 -pady 0 -width 4 -anchor w
52
        pack $f.$lower -side top -pady 0 -anchor w -padx 8
53
    }
54
 
55
    # Use a ButtonBox to hold the buttons.
56
    #
57
    tixButtonBox $w.box -orientation horizontal
58
    $w.box add ok     -text Ok     -underline 0 -command "labf:okcmd $w" \
59
        -width 6
60
    $w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
61
        -width 6
62
 
63
    pack $w.box -side bottom -fill x
64
    pack $w.top -side top -fill both -expand yes
65
}
66
 
67
proc labf:okcmd {w} {
68
    destroy $w
69
}
70
 
71
 
72
# This "if" statement makes it possible to run this script file inside or
73
# outside of the main demo program "widget".
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.