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]
17
18   Parameters:
19       bcolor=string
20           Sets  the  color  of  the  menu background Options: red,orange,yel‐
21           low,green,blue,indigo,vio‐
22           let,white,black,gray,brown,magenta,aqua,grey,cyan,purple   Default:
23           white
24
25       tcolor=string
26           Sets  the  color  of  the  menu   text   Options:   red,orange,yel‐
27           low,green,blue,indigo,vio‐
28           let,white,black,gray,brown,magenta,aqua,grey,cyan,purple   Default:
29           black
30
31       dcolor=string
32           Sets  the  color  dividing  lines  of text Options: red,orange,yel‐
33           low,green,blue,indigo,vio‐
34           let,white,black,gray,brown,magenta,aqua,grey,cyan,purple   Default:
35           black
36
37       size=integer
38           Sets the menu text size (in percent) Options: 1-100 Default: 3
39

DESCRIPTION

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

NOTES

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

EXAMPLES

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

NOTES

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

SEE ALSO

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

AUTHOR

207       James Westervelt, U.S. Army Construction Engineering  Research  Labora‐
208       tory
209
210       Last changed: $Date: 2006/07/07 09:56:35 $
211
212       Full index
213
214
215
216GRASS 6.2.2                                                          d.menu(1)
Impressum