1d.menu(1)                     Grass User's Manual                    d.menu(1)
2
3
4

NAME

6       d.menu   -  Creates  and displays a menu within the active frame on the
7       graphics monitor.
8

KEYWORDS

10       display
11

SYNOPSIS

13       d.menu
14       d.menu help
15       d.menu      [bcolor=string]       [tcolor=string]       [dcolor=string]
16       [size=integer]   [--verbose]  [--quiet]
17
18   Parameters:
19       bcolor=string
20           Sets the color of the menu background
21           Options:                   red,orange,yellow,green,blue,indigo,vio‐
22           let,white,black,gray,brown,magenta,aqua,grey,cyan,purple
23           Default: white
24
25       tcolor=string
26           Sets the color of the menu text
27           Options:                   red,orange,yellow,green,blue,indigo,vio‐
28           let,white,black,gray,brown,magenta,aqua,grey,cyan,purple
29           Default: black
30
31       dcolor=string
32           Sets the color dividing lines of text
33           Options:                   red,orange,yellow,green,blue,indigo,vio‐
34           let,white,black,gray,brown,magenta,aqua,grey,cyan,purple
35           Default: black
36
37       size=integer
38           Sets the menu text size (in percent)
39           Options: 1-100
40           Default: 3
41

DESCRIPTION

43       d.menu allows the user to create a menu containing a TITLE and options,
44       and  to  display this menu in the active frame on the graphics monitor.
45       After the menu is displayed in the active frame, the mouse must be used
46       to  select  one  of  the  menu options.  The number associated with the
47       selected menu option is then printed to standard  output  (stdout)  and
48       the  program  exits.   This program provides GRASS macro writers with a
49       mouse interface for user interaction.
50
51       Parameters can be stated on the  command  line,  from  within  standard
52       input (stdin), or from within a script file (as illustrated below).
53
54       The  user  can  specify  the  menu's  background, text, and line colors
55       (bcolor, tcolor, and dcolor) and the menu size (size)  on  the  command
56       line.  If  the  user  sets  at least one of these values on the command
57       line, any remaining values that are not specified will be set (automat‐
58       ically) to their default values.
59

NOTES

61   Menu Information:
62       After  the  user  has  (optionally) specified menu colors and size, the
63       program expects the user to enter information about the menu's location
64       and  content.  The menu will be placed in the lower right corner of the
65       active display frame by default if the user does not position it  else‐
66       where using the .T or .L commands.
67
68       The  user specifies the menu contents by entering a menu TITLE followed
69       by the option choices to appear in the menu when displayed.   The  user
70       must  enter  a  menu TITLE and at least one menu option.  All .dot com‐
71       mands are optional.
72
73       #      Comment line. (ignored)
74
75       .B value
76              Specifies the menu's background color.
77
78       .C value
79              Specifies the menu's text color.
80
81       .D value
82              Specifies the menu's dividing line color.
83
84       .F value
85              Specifies the menu's font. May be  any  of  the  standard  GRASS
86              fonts.  (see d.font)
87
88       .S value
89              Specifies  the menu's font size.  (as a percentage of the active
90              frame's height).
91
92       .T value
93              Specifies the menu's distance from the  active  display  frame's
94              top edge (as a percentage of the active frame's height).
95
96       .L value
97              Specifies  the  menu's  distance from the active display frame's
98              left edge (as a percentage of the active frame's width).
99
100       menu TITLE
101              A TITLE that describes the type of options listed in  the  menu,
102              and  that  will  appear  at  the top of the menu when it is dis‐
103              played.
104
105       option name(s)
106              The options that will appear in the menu when  displayed.   Each
107              menu  option  should  appear  on  a separate line.  The user may
108              enter as many options as desired, but must enter  at  least  one
109              menu option.
110
111       Note:  The  user should choose a menu size and location that will allow
112       all menu options to be displayed in the active frame.
113
114       If the user enters the menu TITLE and  option(s)  from  standard  input
115       (i.e.,  at the keyboard rather than from a file), the user should enter
116       control-d  to end input and display the menu in the active frame on the
117       graphics  monitor.   (Note: The d.menu program can also be incorporated
118       into UNIX Bourne shell script macros.  The below example shows how this
119       might be done.)
120

EXAMPLES

122   Example 1
123
124       a=`d.menu << EOF
125       # set the background color
126       brown
127       # set the text color
128       # set the text size in % of entire screen height
129       .br # set the top edge
130       # set the LEFT edge
131       # The menu Title
132       Sample Menu
133       # the options
134       option 1
135       option 2
136       option 3
137       option 4
138       option 5
139       option 6
140       EOF
141       `
142       echo "You have just chosen option $a"
143
144
145   Example 2
146       In the following example, the shell script menu2 calls the shell script
147       color.select which contains d.menu commands to display a  menu  in  the
148       current  frame  on  the  graphics  monitor.   After the user selects an
149       option from the display menu, the selection number is available for use
150       by menu2.
151
152   Contents of file menu2:
153
154       #! /bin/csh -f
155       set option = 0
156       set colors = (red green blue black white )
157       @ option = `color.select`
158       if ($option <= 5) then
159            set color = $colors[$option]
160            echo $color
161       endif
162       exit
163
164
165   Contents of file color.select:
166
167       #! /bin/csh -f
168       d.menu bcolor=red tcolor=green dcolor=yellow size=5 << EOF
169       Color Choices
170       Option 1
171       Option 2
172       Option 3
173       Option 4
174       Option 5
175       EOF
176
177
178       If  the user runs menu2, a menu will be displayed on the graphics moni‐
179       tor that has red background, green text, with menu options  divided  by
180       yellow lines, and a text size of 5% of the active display frame height.
181       The mouse cursor will become active, allowing the user  to  select  (by
182       pointing  with  the  mouse)  one  of the displayed menu options.  Here,
183       these menu options are called Option 1, Option 2, and  Option  3,  etc.
184       The  first  line  of  text (here, the words Color Choices) contains the
185       TITLE of the menu; this line is not a menu option that can be chosen by
186       the user with the mouse. When the user presses one of the mouse buttons
187       while pointing to the desired menu choice, the  number  of  the  option
188       chosen  will be available for capture by the shell script menu2.  menu2
189       is a simple example that takes this information and only echoes  it  to
190       the screen.
191

NOTES

193       Although  the user can vary text size, all text within the same menu is
194       displayed in a single text size (and font). If the user specifies  that
195       items  included in the menu's text be displayed in different sizes, all
196       text will be displayed in the size stated last.
197

SEE ALSO

199       d.ask
200       d.font
201       d.frame
202       d.grid
203       d.legend
204       d.paint.labels
205       d.text
206       d.title
207

AUTHOR

209       James Westervelt, U.S. Army Construction Engineering  Research  Labora‐
210       tory
211
212       Last changed: $Date: 2006-07-07 11:56:35 +0200 (Fri, 07 Jul 2006) $
213
214       Full index
215
216       © 2003-2008 GRASS Development Team
217
218
219
220GRASS 6.3.0                                                          d.menu(1)
Impressum