create
PW_MENU_KEYPRESSES
Set the keypresses which should be used to allow the user to scroll the menu without indicating the scroll items. This tag needs four parameters, first the keypresses for scrolling a line up and down, then the keypresses for scrolling a page up and down. If this tag is not passed, then the standard keypresses for scrolling are defined (<ALT up/down> and <ALT SHIFT up/down>).
query
PW_MENU_FIRST
Get the first item in the menu. This query should be used to initialise cycling over all items in the menu. The first item will become the current item.
PW_MENU_NEXT
Get the next item in the menu. This query should only be used if the current item was initialised using a PW_MENU_FIRST query. The returned item will become the current. If all items in the menu have been returned, then a NULL will be returned and the current item is undefined (can be anything).
PW_MENU_AVAILABLE_FIRST
Get the first available item in the menu. This query should be used to initialise cycling over all available items in the menu. The returned item will become the current item.
PW_MENU_AVAILABLE_NEXT
Get the next available item in the menu. This query should only be used if the current item was initialised using a PW_MENU_AVAILABLE_FIRST query. The returned item will become the current. If all available items in the menu have been returned, then a NULL will be returned and the current item is undefined (can be anything).
PW_MENU_SELECTED_FIRST
Get the first selected item in the menu. This query should be used to initialise cycling over all selected items in the menu. The returned item will become the current item.
PW_MENU_SELECTED_NEXT
Get the next selected item in the menu. This query should only be used if the current item was initialised using a PW_MENU_SELECTED_FIRST query. The returned item will become the current. If all selected items in the menu have been returned, then a NULL will be returned and the current item is undefined (can be anything).
PW_MENU_STATUS_CURRENT
Get the status of the current item in the menu.
PW_MENU_FIRST_NUMBER
PW_MENU_NEXT_NUMBER
PW_MENU_AVAILABLE_FIRST_NUMBER
PW_MENU_AVAILABLE_NEXT_NUMBER
PW_MENU_SELECTED_FIRST_NUMBER
PW_MENU_SELECTED_NEXT_NUMBER
Similar to the query tags which do not end in "_NUMBER", except that they do not return a pointer to the item, but the number of the item in the menu. The numbering starts at zero. This can be usefull especially when PW_MENU_ADD_ARRAY was used, to just get the index of the item in the array (if the menu is not sorted that is).
PW_MENU_AVAILABLE_NUMBER
PW_MENU_UNAVAILABLE_NUMBER
PW_MENU_SELECTED_NUMBER
Count the number of items in the menu with the given status. The result is of type int.
change
PW_MENU_ADD
Add an item inside the menu. If the menu is not sorted, the item will be added at the end. The parameter should be of type "char *". The pointer to the string is copied, so the memory which contains the string should persist. The current item, as last returned with one of the queries, is reset when adding something to the menu.
PW_MENU_ADD_COPY
Add an item inside the menu. If the menu is not sorted, the item will be added at the end. The parameter should be of type "char *". The string is copied in some memory allocated by the menu. The current item, as last returned with one of the queries, is reset when adding something to the menu.
PW_MENU_ADD_ARRAY
Add all strings from an array of string to the menu. If the menu is not sorted, then the items are added at the end, in the same order as in the array. This tag requires three parameters, the number of strings in the array, the length of each string, and the base of the array (note that the first two parameters are the indexes used when declaring the array). The items in the menu will just point to the position in the array, so the array should persist. The current item, as last returned with one of the queries, is reset when adding something to the menu.
PW_MENU_ITEMWIDTH
Specify the width of each item in the menu. The parameter is of type "pt", the width in PROforma coordinates.
PW_MENU_ITEMWIDTH_PIX
Specify the width of each item in the menu. The parameter is of type "int", the width in pixels.
PW_MENU_ITEMWIDTH_FS
Specify the width of each item in the menu. The parameter is of type "pt", which is interpretted as a factor, the base unit being the fontsize used.
PW_MENU_ITEMWIDTH_MAX
Specify that the itemwidth which should be used inside the menu should be the maximum width of all the items in the menu (this is the default). This tag requires no parameters. An attempt is made to prevent that the size of all objects in the window are redetermined when the itemwidth changes because a larger item appears. This cand influence the appearance of the window (compared with the other case) if items are added while the window is visible !
PW_MENU_ITEMWIDTH_COLUMNS
The width of the items will be such that the requested number of columns can be displayed in the menu. This tag requires one integer parameter, the number of columns.
PW_MENU_ACTION_SELECT
Specify a routine which should be called each time an item is selected. The parameter should be of type "Error (*)(PWObject, char *)", with the "char *" being the item which is being selected. This routine is not called when a DOSELECT routine is set and the item was indicated using a DO.
PW_MENU_ACTION_DOSELECT
Specify a routine which should be called each time an item is selected using a DO. The parameter should be of type "Error (*)(PWObject, char *)", with the "char *" being the item which is being selected. If this is not defined, and the item is selected, then the normal select routine will be called. Please note that the PW_MENU_WINDOW_DO tag has no effect if a DOSELECT routine is set.
PW_MENU_ACTION_DESELECT
Specify a routine which should be called each time an item is deselected. The parameter should be of type "Error (*)(PWObject, char *)", with the "char *" being the item which is being deselected.
PW_MENU_UNIQUE
Tell the menu that at most one item can be selected at any instant. This tag needs no parameters. When this tag is given, all selected items in the menu will be deselected.
PW_MENU_SORT_COMPARE
This tag allows you to pass a compare routine to a menu, for example, STRCompareCI or STRCompareCD. It requires one parameter of type "Error *rout(char *str, char *with, int *result)". If the parameter is NULL then the menu is not sorted.
PW_MENU_VISIBLE_LINES
Specify the minimum number of lines which should be visible in the menu. Each line could (if the menu is wide enough) contain more than one item. The parameter is of type "int".
PW_MENU_CLEAR
Clear the menu. All the items will be removed from the menu. The current itemwidth is reduced to zero if the maximum width is the current option. This tags does not need a parameter. The current item, as last returned with one of the queries, is reset when adding something to the menu.
PW_MENU_WINDOW_DO
The parameter is either TRUE or FALSE. By default it is FALSE. When the window do status is TRUE, then the <enter> keypress is also handled by the system (thus a keypress object can react to it). However, if there is a special DOSELECT routine for the menu, then this tag has no effect !
PW_MENU_NONE_SELECTED
This tag is similar to the PW_MENU_UNIQUE tag, except that in this case, a menu item will never be displayed as selected. However, when a menu item is indicated, the menu Select routine will still be called. This tag does not need a parameter.
PW_MENU_STATUS
Change the status of an item in the menu. This tag needs two parameters, the new status and the item. The new status should be one of PW_STATUS_AVAILABLE, PW_STATUS_UNAVAILABLE or PW_STATUS_SELECTED. The item is passed as a "char *", the position of the item. Please notice that the pointers are compared, and therefore you whould be ware when doing this for copied items. When changing the status of an item, the Select or DeSelect routines are not called, except when it causes an item to be deselected (because PW_MENU_UNIQUE). When PW_MENU_NONE_SELECTED, this tag can only be used to make an item available or unavailable.
PW_MENU_STATUS_ALL
Set the status of all the item in the window to the status which is given as parameter. This will do nothing when you can't select more than one item at a time.
PW_MENU_STATUS_CURRENT
Change the status of the current item, being the last one which was returned by one of the queries. This tag requires only one parameter, the new status, either PW_STATUS_AVAILABLE, PW_STATUS_UNAVAILABLE or PW_STATUS_SELECTED. When changing the status of an item, the Select or DeSelect routines are not called, except when it causes another item to be deselected (because PW_MENU_UNIQUE). When PW_MENU_NONE_SELECTED, this tag can only be used to make an item available or unavailable.

PROGS, Professional & Graphical Software
last edited May 5, 1997