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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [demos/] [samples/] [BtnBox.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
# This file demonstrates the use of the tixButtonBox widget, which is a
10
# group of TK buttons. You can use it to manage the buttons in a dialog box,
11
# for example.
12
#
13
proc RunSample {w} {
14
 
15
    # Create the label on the top of the dialog box
16
    #
17
    label $w.top -padx 20 -pady 10 -border 1 -relief raised -anchor c -text \
18
        "This dialog box is\n a demostration of the\n tixButtonBox widget"
19
 
20
    # Create the button box and add a few buttons in it. Set the
21
    # -width of all the buttons to the same value so that they
22
    # appear in the same size.
23
    #
24
    # Note that the -text, -underline, -command and -width options are all
25
    # standard options of the button widgets.
26
    #
27
    tixButtonBox $w.box -orientation horizontal
28
    $w.box add ok    -text OK    -underline 0 -command "destroy $w" -width 5
29
    $w.box add close -text Close -underline 0 -command "destroy $w" -width 5
30
 
31
    pack $w.box -side bottom -fill x
32
    pack $w.top -side top -fill both -expand yes
33
 
34
    # "after 0" is used so that the key bindings won't interfere with
35
    # tkTraverseMenu
36
    #
37
    bind [winfo toplevel $w] <Alt-o>  \
38
        "after 0 tkButtonInvoke [$w.box subwidget ok]"
39
    bind [winfo toplevel $w] <Alt-c>  \
40
        "after 0 tkButtonInvoke [$w.box subwidget close]"
41
    bind [winfo toplevel $w] <Escape> \
42
        "after 0 tkButtonInvoke [$w.box subwidget close]"
43
 
44
    focus [$w.box subwidget ok]
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.