AT&T UNIX™PC Unix System V Users Manual - tenox
AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox
MENU (3T) (AT&T UNIX PC only ) MENU (3T) mitem_t *m_topi; } menu_t; j* item at top of dpy * / M_label is displayed in the menu's window label line. If m_label is NULL, no label is displayed. M_title is a title for the menu. If m_title is NULL, the menu is displayed without any title. If m_title contains newline characters, all but the first line of the title are underlined. M_prompt (when non-NULL) is an prompt for the menu. All prompts are displayed on the system prompt line, generally located at the bottom of the display. M_rows and m_cols allow the caller to specify the number of rows and columns of items. Either or both of these values may be zero, in which case menu will try to pick "good" values. It is quite common to specify "zero" rows and one column to force output to be vertical. When both m_rows and m_cols are zero, menu tries to fit the menu into an appealing rectangle. M_iwidth specifies a maximum width for each item. If m_iwidth is zero, menu will display as much of the item as possible given the available window real-estate. If m_iwidth is non-zero, items are automatically truncated to that width, regardless of other parameters. This is very useful when generating multi-column menus where the caller wishes to prevent one long item from disrupting the columnar output. M_IWIDTH IS NOT YET IMPLE- ·1 MENTED. M_iheight allows the caller to specify the number of rows per item on the display. Newline characters in the item's name cause menu to advance to the next row. If m_iheight is zero, one-row items are assumed. M_IHEIGHT IS NOT YET IMPLEMENTED. M_ft ags contains the M_SINGLE flag which prohibits the user from selecting more than one item from the menu. If the M_SINGLE flag is off, the user may select multiple items from the menu. The M_USEWIN flag, if set, will cause menu to use the window supplied in m_win instead of creating its own. If M_USEWIN is set, M_BEGIN operations will re-size the window (as necessary) and M_END operations do not delete the window. The M_WINNEW flag causes menu to use the "new " algorithm to place the window. Basically, the new algorithm looks for relatively empty screen space to place the window. M_ WINSON causes menu to use the "son" algorithm which causes the new window to slightly overlap the current window. If neither M_WINNEW nor M_WINSON is given, the "popup" algorithm is used. This causes the new window to appear near the middle of � the current window, inside it if possible. The M_NOMOVE, M_NOHELP, and M_NORESIZE flags, if set, prevent the Move, Help and Resize icons, respectively, from being displayed on the menu border. The M....ASISTITLE flag, if set, causes the menu title to be displayed as supplied by the user, i.e., without centering. - 2-
MENU (3T) (AT&T UNIX PC only ) MENU (3T) M_lbuf is an array of characters which is used to assemble typed input. It is always returned to the caller in case it is necessary to record keystrokes. In addition, the user may enter keystroke data which does not match any items. In this case m_selcnt is set to zero on return. M_win holds the window identifier associated with this menu. It is allocated on an M_BEGIN call, used on subsequent calls, and deleted on an M_END call. M_track is a pointer to the mousetracking information required during menu interaction. The space for this data is allocated on M_BEGIN and freed on M_END. The caller should not use m_track, m_oldwidth, or m_oldheight. They may be left un-initialized on call to M_BEGIN. If a value must be given (as in a mitem_t initializer), a value of zero should be used. On return, m_selcnt contains a count of the number of selected items. M_items points to the array of menu items (see below). M_ curi points to the current item. The caller should point m_curi to the default item. Menu will modify m_curi as the user moves the highlighting around in the menu. The list of menu items is terminated by an item whose mi_name is NULL. M_topi contains a pointer to the item which is at the top of the display. As the window scrolls through the menu, m_topi changes to reflect the new position of the view. The caller needn't initialize m_topi as menu will compute a "good" initial view from the value in m_curi. In general, callers will not read the value in m_topi and should never write it. Each item in the array pointed to by m_items and m_curi has the following form: typedef struct { char char int } mitem_t; *mi_name; mi_flags; mi_val; /* name of item * / /* flags * / /* user-supplied value * / Mi_name is the item name, mi_ftags contains the M_MARKED flag which indicates that this item should be marked (on call) and/or was marked (on return) and/or the M_DIMMED flag which indicates that this item should be displayed in lowerintensity. Mi_val is unused by menu and is available for application-specific data. Often, mi_val contains a small positive integer identifying the particular choice. EXAMPLE The following program illustrates a simple single-selection menu: #include #include #include #include - 3-
- Page 881 and 882: GETUT ( 3C ) GETUT ( 3C ) NAME getu
- Page 883 and 884: HSEARCH ( 3C ) HSEARCH ( 3C ) NAME
- Page 885 and 886: HYPOT ( 3M ) HYPOT (3M) NAME hypot
- Page 887: L3TOL (3C) L3TOL (3C) NAME 13tol, l
- Page 890 and 891: (�
- Page 893: LDFHREAD ( 3X ) LDFHREAD ( 3X ) NAM
- Page 897 and 898: LDLSEEK ( 3X ) LDLSEEK ( 3X ) NAME
- Page 899 and 900: LDOHSEEK ( 3X ) (not on PDP-11) LDO
- Page 901 and 902: LDOPEN{3X) LDOPEN { 3X) NAME ldopen
- Page 903 and 904: LDRSEEK ( 3X ) LDRSEEK ( 3X ) NAME
- Page 905: LDSHREAD ( 3X ) LDSHREAD ( 3X ) NAM
- Page 908 and 909: ,ry
- Page 910 and 911: � '"'"--
- Page 912 and 913: I!) r) ·--... .._ _ .. .
- Page 914 and 915: y I
- Page 916 and 917: LOCKF (3C) LOCKF (3C) F _LOCK and F
- Page 918 and 919: I� ' .... ._ .·
- Page 920 and 921: LSEARCH ( 3C ) LSEARCH ( 3C ) unsig
- Page 922 and 923: MALLOC (3C) MALLOC (3C) M_NLBLKS Se
- Page 924 and 925: MA THERR (3M) MATHERR (3M) } BESSEL
- Page 926 and 927: () . -�
- Page 928 and 929: MEMORY (3C} MEMORY (3C) Character m
- Page 932 and 933: MENU (3T) (AT&T UNIX PC only ) mite
- Page 934 and 935: MENU (3T) (AT&T UNIX PC only ) FILE
- Page 936 and 937: MESSAGE ( 3T ) ( AT&T UNIX PC only
- Page 939: MONITOR ( 3C ) MONITOR ( 3C ) NAME
- Page 943 and 944: PASTE (3T) (AT&T UNIX PC only ) PAS
- Page 945 and 946: PASTE ( 3T ) ( AT&T UNIX PC only )
- Page 947: PERROR (3C) PERROR (3C) NAME perror
- Page 950 and 951: (� / I I I I I I I I I I I I I I
- Page 952 and 953: PRINTF (3S) PRINTF (3S) A field wid
- Page 955 and 956: PUTC ( 3S ) PUTC ( 3S ) NAME putc,
- Page 957: PUTENV (3C) PUTENV (3C) NAME putenv
- Page 960 and 961: ···- ·
- Page 962 and 963: I� ·-.---·
- Page 964 and 965: ' ' .} ' 1 . ' .____.,.:
- Page 966 and 967: � ·�
- Page 968 and 969: REGCMP {3X) REGCMP {3X) ( . . . ) P
- Page 970 and 971: SCANF(3S) u 0 X SCANF(3S) an unsign
- Page 973 and 974: � I SETBUF (3S) SETBUF (3S) NAME
- Page 975 and 976: SETJMP (3C) SETJMP ( 3C ) NAME setj
- Page 977 and 978: SINII ( 3M ) SINH ( 3M ) NAME sinh,
- Page 979 and 980: SLEEP (3C) SLEEP ( 3C ) NAME sleep
MENU (3T) (AT&T UNIX PC only ) MENU (3T)<br />
M_lbuf is an array of characters which is used to assemble typed<br />
input. It is always returned to the caller in case it is necessary to<br />
record keystrokes. In addition, the user may enter keystroke data<br />
which does not match any items. In this case m_selcnt is set to<br />
zero on return.<br />
M_win holds the window identifier associated with this menu. It<br />
is allocated on an M_BEGIN call, used on subsequent calls, and<br />
deleted on an M_END call. M_track is a pointer to the mousetracking<br />
information required during menu interaction. The space<br />
for this data is allocated on M_BEGIN and freed on M_END.<br />
The caller should not use m_track, m_oldwidth, or m_oldheight.<br />
They may be left un-initialized on call to M_BEGIN. If a value<br />
must be given (as in a mitem_t initializer), a value of zero should<br />
be used.<br />
On return, m_selcnt contains a count of the number of selected<br />
items.<br />
M_items points to the array of menu items (see below). M_ curi<br />
points to the current item. The caller should point m_curi to the<br />
default item. Menu will modify m_curi as the user moves the<br />
highlighting around in the menu. The list of menu items is terminated<br />
by an item whose mi_name is NULL. M_topi contains a<br />
pointer to the item which is at the top of the display. As the window<br />
scrolls through the menu, m_topi changes to reflect the new<br />
position of the view. The caller needn't initialize m_topi as menu<br />
will compute a "good" initial view from the value in m_curi. In<br />
general, callers will not read the value in m_topi and should never<br />
write it.<br />
Each item in the array pointed to by m_items and m_curi has<br />
the following form:<br />
typedef struct<br />
{<br />
char<br />
char<br />
int<br />
} mitem_t;<br />
*mi_name;<br />
mi_flags;<br />
mi_val;<br />
/* name of item * /<br />
/* flags * /<br />
/* user-supplied value * /<br />
Mi_name is the item name, mi_ftags contains the M_MARKED<br />
flag which indicates that this item should be marked (on call)<br />
and/or was marked (on return) and/or the M_DIMMED flag<br />
which indicates that this item should be displayed in lowerintensity.<br />
Mi_val is unused by menu and is available for<br />
application-specific data. Often, mi_val contains a small positive<br />
integer identifying the particular choice.<br />
EXAMPLE<br />
The following program illustrates a simple single-selection menu:<br />
#include <br />
#include <br />
#include <br />
#include <br />
- 3-