2 <BODY BGCOLOR="#99ccbb" TEXT="#000000" LINK="#4060b0" VLINK="#000080" ALINK="#ff4040">
4 <STRONG>menu_driver</STRONG> - command-processing loop of the menu system
9 <STRONG>#include</STRONG> <STRONG><menu.h></STRONG>
10 int menu_driver(MENU *menu, int c);
14 <H2>DESCRIPTION</H2><PRE>
15 Once a menu has been posted (displayed), you should funnel
16 input events to it through <STRONG>menu_driver</STRONG>. This routine has
17 two major input cases; either the input is a menu naviga-
18 tion request or it's a printable ASCII character. The
19 menu driver requests are as follows:
25 Move right to an item.
46 Move to the first item.
49 Move to the last item.
52 Move to the next item.
55 Move to the previous item.
58 Select/deselect an item.
60 Clear the menu pattern buffer.
63 Delete the previous character from the pattern
67 Move to the next item matching the pattern match.
70 Move to the previous item matching the pattern match.
72 If the second argument is a printable ASCII character, the
73 code appends it to the pattern buffer and attempts to move
74 to the next item matching the new pattern. If there is no
75 such match, <STRONG>menu_driver</STRONG> returns <STRONG>E_NO_MATCH</STRONG> and deletes the
76 appended character from the buffer.
78 If the second argument is one of the above pre-defined
79 requests, the corresponding action is performed.
81 If the second argument is neither printable ASCII nor one
82 of the above pre-defined menu requests, the drive assumes
83 it is an application-specific command and returns
84 <STRONG>E_UNKNOWN_COMMAND</STRONG>. Application-defined commands should be
85 defined relative to <STRONG>MAX_COMMAND</STRONG>, the maximum value of
86 these pre-defined requests.
90 <H2>RETURN VALUE</H2><PRE>
91 <STRONG>menu_driver</STRONG> return one of the following error codes:
93 <STRONG>E_OK</STRONG> The routine succeeded.
95 <STRONG>E_SYSTEM_ERROR</STRONG>
96 System error occurred (see <STRONG>errno</STRONG>).
98 <STRONG>E_BAD_ARGUMENT</STRONG>
99 Routine detected an incorrect or out-of-range argu-
102 <STRONG>E_BAD_STATE</STRONG>
103 Routine was called from an initialization or termina-
106 <STRONG>E_NOT_POSTED</STRONG>
107 The menu has not been posted.
109 <STRONG>E_UNKNOWN_COMMAND</STRONG>
110 The menu driver code saw an unknown request code.
112 <STRONG>E_NO_MATCH</STRONG>
113 Character failed to match.
114 The menu driver could not process the request.
118 <H2>SEE ALSO</H2><PRE>
119 <STRONG><A HREF="ncurses.3x.html">curses(3X)</A></STRONG>, <STRONG><A HREF="menus.3x.html">menus(3x)</A></STRONG>.
124 The header file <STRONG><menu.h></STRONG> automatically includes the header
125 files <STRONG><curses.h></STRONG>.
129 <H2>PORTABILITY</H2><PRE>
130 These routines emulate the System V menu library. They
131 were not supported on Version 7 or BSD versions.
135 <H2>AUTHORS</H2><PRE>
136 Juergen Pfeifer. Manual pages and adaptation for new
137 curses by Eric S. Raymond.