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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [demos/] [samples/] [SWindow.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
# This file demonstrates the use of the tixScrolledWindow widget.
10
#
11
 
12
proc RunSample {w} {
13
 
14
    # We create the frame and the ScrolledWindow widget
15
    # at the top of the dialog box
16
    #
17
    frame $w.top -relief raised -bd 1
18
 
19
    # Create a complex window inside the ScrolledWindow widget.
20
    # ScrolledWindow are very convenient: unlink the canvas widget,
21
    # you don't need to specify the scroll-redions for the
22
    # ScrolledWindow. It will automatically adjust itself to fit
23
    # size of the "window" subwidget
24
    #
25
    # [Hint] Be sure you create and pack new widgets inside the
26
    #        "window" subwidget and NOT inside $w.top.a itself!
27
    #
28
    tixScrolledWindow $w.top.a
29
    pack $w.top.a -expand yes -fill both -padx 10 -pady 10 -side left
30
 
31
    set f [$w.top.a subwidget window]
32
    tixNoteBook $f.nb
33
    pack $f.nb -expand yes -fill both -padx 20 -pady 20
34
 
35
 
36
    $f.nb add image   -label "Image"   -underline 0
37
    $f.nb add buttons -label "Buttons" -underline 0
38
 
39
    # The first page: an image
40
    #
41
    global demo_dir
42
    set p [$f.nb subwidget image]
43
    set im [image create photo -file $demo_dir/bitmaps/tix.gif]
44
    label $p.lab -image $im
45
    pack $p.lab -padx 20 -pady 20
46
 
47
    # The second page: buttons
48
    #
49
    set p [$f.nb subwidget buttons]
50
    button $p.b1 -text "Welcome"  -width 8
51
    button $p.b2 -text "to"       -width 8
52
    button $p.b3 -text "the"      -width 8
53
    button $p.b4 -text "World"    -width 8
54
    button $p.b5 -text "of"       -width 8
55
    button $p.b6 -text "Tix"      -width 8
56
 
57
    pack $p.b1 $p.b2 $p.b3 $p.b4 $p.b5 $p.b6 -anchor c -side top
58
 
59
 
60
    # Use a ButtonBox to hold the buttons.
61
    #
62
    tixButtonBox $w.box -orientation horizontal
63
    $w.box add ok     -text Ok     -underline 0 -command "destroy $w" \
64
        -width 6
65
    $w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
66
        -width 6
67
 
68
    pack $w.box -side bottom -fill x
69
    pack $w.top -side top -fill both -expand yes
70
 
71
    wm geometry $w 240x220
72
}
73
 
74
 
75
# This "if" statement makes it possible to run this script file inside or
76
# outside of the main demo program "widget".
77
#
78
if {![info exists tix_demo_running]} {
79
    wm withdraw .
80
    set w .demo
81
    toplevel $w
82
    RunSample $w
83
        bind $w <Destroy> exit
84
}
85
 

powered by: WebSVN 2.1.0

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