URL
https://opencores.org/ocsvn/or1k/or1k/trunk
[/] [or1k/] [trunk/] [insight/] [tk/] [library/] [optMenu.tcl] - Blame information for rev 1780
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
578 |
markom |
# optMenu.tcl --
|
2 |
|
|
#
|
3 |
|
|
# This file defines the procedure tk_optionMenu, which creates
|
4 |
|
|
# an option button and its associated menu.
|
5 |
|
|
#
|
6 |
|
|
# SCCS: @(#) optMenu.tcl 1.11 97/08/22 14:21:13
|
7 |
|
|
#
|
8 |
|
|
# Copyright (c) 1994 The Regents of the University of California.
|
9 |
|
|
# Copyright (c) 1994 Sun Microsystems, Inc.
|
10 |
|
|
#
|
11 |
|
|
# See the file "license.terms" for information on usage and redistribution
|
12 |
|
|
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
13 |
|
|
#
|
14 |
|
|
|
15 |
|
|
# tk_optionMenu --
|
16 |
|
|
# This procedure creates an option button named $w and an associated
|
17 |
|
|
# menu. Together they provide the functionality of Motif option menus:
|
18 |
|
|
# they can be used to select one of many values, and the current value
|
19 |
|
|
# appears in the global variable varName, as well as in the text of
|
20 |
|
|
# the option menubutton. The name of the menu is returned as the
|
21 |
|
|
# procedure's result, so that the caller can use it to change configuration
|
22 |
|
|
# options on the menu or otherwise manipulate it.
|
23 |
|
|
#
|
24 |
|
|
# Arguments:
|
25 |
|
|
# w - The name to use for the menubutton.
|
26 |
|
|
# varName - Global variable to hold the currently selected value.
|
27 |
|
|
# firstValue - First of legal values for option (must be >= 1).
|
28 |
|
|
# args - Any number of additional values.
|
29 |
|
|
|
30 |
|
|
proc tk_optionMenu {w varName firstValue args} {
|
31 |
|
|
upvar #0 $varName var
|
32 |
|
|
|
33 |
|
|
if {![info exists var]} {
|
34 |
|
|
set var $firstValue
|
35 |
|
|
}
|
36 |
|
|
menubutton $w -textvariable $varName -indicatoron 1 -menu $w.menu \
|
37 |
|
|
-relief raised -bd 2 -highlightthickness 2 -anchor c \
|
38 |
|
|
-direction flush
|
39 |
|
|
menu $w.menu -tearoff 0
|
40 |
|
|
$w.menu add radiobutton -label $firstValue -variable $varName
|
41 |
|
|
foreach i $args {
|
42 |
|
|
$w.menu add radiobutton -label $i -variable $varName
|
43 |
|
|
}
|
44 |
|
|
return $w.menu
|
45 |
|
|
}
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.