Keywords: Cmenu

Next: menu_popup Up: Function Reference Previous: Processing return Values Contents

## Complex Return Values

Dealing with complex return values occur when menu items including radio lists, check lists and editing data fields. Essentially these type of items create multi-value responses. To do this, Cmenu returns an array of values separated by separation characters.
@values = split(/$Cmenu::menu_sep/,$sel)
will perform the first split. The array of values will contain the function key or menu item pressed when the menu was exited. Other values will correspond to specific menu items. For radio and check list, this will be a simple list of which items had been selected. When dealing with such lists, Cmenu does not attempt to report unselected items - these should be processed independently - Cmenu will only returns items which have been checked.

To deal with data fields, a field identifier and the field contents will be returned as a data pair. These can be separated with the following command;

($identifier,$contents) = split($Cmenu::menu_sepn/,$value[1]);
Notice that $value[1] is one of the elements of the first array. Normally, values returned in this way will be ordered as they were defined with menu_item calls but this is not guaranteed. The $identifier is the value specified in the original $menu_item call.

Where this return value can get really messy is when a complex data entry menu has a combination of regular, alpha, numeric, radio and check list menu items. You will need to take care that you identify all the parts you need for each item. When in doubt or to aid debugging, doing a simple call to menu_show can help

&menu_show(``Data Response'',$sel,''HELP'');
This will show what Cmenu is returning from a particular call.

Next: menu_popup Up: Function Reference Previous: Processing return Values Contents