# Popup Menu

List Box and Grid System Popup Menu |

A system popup menu consisting of the following extraction, search and print options can be added to any Grid or List Box (except Tree Views):

> Copy Column
> Copy Selected Record(s)
> Copy All Records
> Export All Records to File
> Export All Records to Spreadsheet (MS Excel 2003 or later)
> Find...
> Find Next
> Find Previous
> Goto …
> Define a chart
> Display chart
> Print
> Advanced Print

(The List Box and Grid system popup menu was added in PxPlus v10.)
(The AutoChart functionality was added to the system popup menu in PxPlus v11.00.)
(The Export to Spreadsheet option was added to the system popup menu in PxPlus 2014.)
(The Advanced Print option was added to the system popup menu in PxPlus 2021 Update 1.)

The functionality associated with these options is summarized below:

Copy | These options place data on the Windows Clipboard. Available Copy options are dependent on the List Box type and, in iNomads, on browser type (IE only).
Export to File | These formats include comma-separated (.csv), symbolic link (.slk), Microsoft 2003 XML (.xml) and tab delimited (.txt, *.*).
Export to Spreadsheet | This option creates an .xml file and opens it with the default spreadsheet application.
Find | These options are used to search the contents of the List Box for occurrences of a specified string.
Goto | This option is used to go to a specific item.
Define a chart | This option invokes the Chart Wizard that is used to define a NOMADS AutoChart for the list.
Display chart | This option shows the AutoCharts that have been defined.
Print | This option outputs a formatted version of the List Box contents to the viewer in NOMADS or a PDF file in iNomads.
Advanced Print | This option invokes the Advanced Print Options window used for customizing the report by changing the main title or adding a sub-heading containing selected information from the current panel. This window consists of the following:
Report Title | Main title at the top of the report. By default, the title from the panel header definition is displayed.
Select | Select this check box to indicate that the description and value are to display in the report sub-heading. This information can be displayed as shown or edited to be more meaningful. If none of the Select check boxes is checked, a message will display when the Ok button is selected.
Description | This column displays the names of the panel controls, which can include Multi-lines, List Boxes, Drop Boxes, Check Boxes, Radio Buttons, and Grid cells. A comment can also be added as a Note to the report.
Value | This column displays the original values (if applicable) for the panel controls; otherwise, it will be blank. If the original value is edited, an * (asterisk) will display in front of the value when the report is printed to indicate that the original value was changed.
Ok | Generates a preview of the report.
Cancel | Cancels the report.

## Handling the System Popup Menu

Adding/Removing the System Popup Menu

System popup menus can be added to all List Boxes and Grids by setting the global variable %LIST_POPUP to non-zero.

The system popup can also be added or removed from individual List Boxes and Grids. This is done by first selecting the Popup Menu button in the List Box or Grid definition and then setting the System Popup option to On or Off. This setting overrides the %LIST_POPUP setting unless the Default setting is selected.

If a List Box or Grid already has a popup menu assigned to it, a new menu group, List Options..., is added to the bottom of the existing popup menu for accessing the additional options.

Modifying the System Popup Menu

To change the text of the menu group, load the desired menu text into the %LIST_POPUP$ variable. Since the text will become a popup menu item, an & (ampersand) character may be used to indicate the hot key associated with the item.

Example:

S&ystem Items ...

If no & (ampersand) is included in the text, it will be assumed to be at the beginning of the text entered; therefore, the first character will be used as the hot key.

#### Note:
The popup menu associated with the Grid in general is affected, not cell-level popup menus.

To suppress options displayed in the popup menu, set the %LIST_POPUP_SUPPRESS_OPTIONS$ global variable to indicate which options are to be suppressed. Any combination of "C", "E", "F", "G", "L", and/or "P" will cause the Copy, Export, Find, Chart, Goto and/or Print items respectively to be suppressed.

Example:

> %LIST_POPUP_SUPPRESS_OPTIONS$="CE" will cause the Copy and Export items to be suppressed, while the Find and Print items remain available. This setting will apply to all List Box and Grid system popup menus for the session.

To attach the popup menu to an event other than the right-click popup event of the List/Grid control (such as a button click), invoke the menu as follows:

> ! Set the Popup_Ctlval variable to the CTL value of the associated List/Grid control
> Popup_Ctlval =ctl_val
> Popup_Select =0
> ! Then perform the following program:
> PERFORM "*plus/winutl/listpopup;Popup_Menu"

The items displayed in the popup will be dependent on the value in %LIST_POPUP_SUPPRESS_OPTIONS$.

To use any of the individual popup features without using the system popup menu, invoke the feature as follows:

> Popup_Ctlval=ctl_val
> Popup_Select=option
> PERFORM "*plus/winutl/listpopup;Popup_Menu

Where:

Options for Popup_Select are:

| 1 | Copy row to Clipboard
| 2 | Copy all to Clipboard
| 3 | Export all to file (Prompts for file name)
| 4 | Print
| 5,6,7 | Find, Find Next, Find Previous
| 8 | Define Chart
| 9 | Display Chart
| 11 | Export All to Spreadsheet

#### Note:
Individual items are not suppressed by the setting of %LIST_POPUP_SUPPRESS_OPTIONS$.

To invoke the Export All Records to File feature with a file name:

> CALL "*plus/winutl/listpopup;Export_to_File",ctl_no,exportfile$

Where:

| ctl_no | CTL value of the List Box or Grid
| exportfile$ | Path of the resulting file. The file extension will indicate the type of export:
.txt or none | Tab-separated file
.csv | Comma-separated
.slk | Symbolic link
.xml | Microsoft 2003 XML

#### Note:
The three global variables (%LIST_POPUP, %LIST_POPUP$ and %LIST_POPUP_SUPPRESS_OPTIONS$) correspond to the three %NOMADS object properties %NOMADS'List_Popup, %NOMADS'List_Popup$ and %NOMADS'List_Popup_Suppress_Options$.
See %NOMADS Properties.
(The NOMADS object properties %NOMADS'List_Popup, %NOMADS'List_Popup$ and %NOMADS'List_Popup_Suppress_Options$ were added in PxPlus 2020.)