# Using Smart Controls Outside of NOMADS

> Source: https://manual.pvxplus.com/nomads-graphical-application/smart-controls/using-smart-controls-outside-of-nomads

Smart controls are designed to work within the confines of NOMADS. It is possible, however, to invoke the auto-load logic for Smart List Box, Drop Box and Grid controls programmatically. To load the Smart control, make a CALL to the program **\*winlist** as follows:

```
CALL "*winlist", q_name$, q_library$, smartlist.ctl [,var_iol$, var_rec$]
```

***Where:***

|  |  |  |
| --- | --- | --- |
|  | *q_name$* | Name of the query object definition to be used. |
|  | *q_library$* | Name of the library in which the query object definition is located. If null, default is the currently open library. |
|  | *smartlist.ctl* | CTL value of the list box to be loaded. |
|  | *var_iol$* | ***(Optional)*** Compiled IOList of variables to be passed to the Load logic. |
|  | *var_rec$* | ***(Optional)*** Values of variables in the IOList derived by REC(*var_iol$* **)**. |

Note:  
If you want to use \*winlist to auto-load a Formatted List Box using the format from the query object, it is necessary to define the List Box with a format of L1 so that it can be differentiated from a Standard List Box that has no format. (This is not necessary for Report View format whose format can be left blank.)

A native chart can also be auto-loaded by making a CALL to the program **\*[TOOLS/CHARTIMAGE](https://manual.pvxplus.com/utilities/chart-image)**:

```
CALL "*tools/chartimage", ERR=stmtref, query$, library$, chart$, control, [,controlSettings, var_iol$, var_rec$]
```

|  |  |  |
| --- | --- | --- |
|  | *query$* | Name of the query which owns the chart. |
|  | *library$* | Path of the library where the query definition resides. |
|  | *chart$* | Name given to the AutoChart definition associated with the query. (***Must*** be a *public* definition) |
|  | *control* | CTL value of the chart control to be loaded. |
|  | *controlSettings* | Values are:<br>0 - Use chart format/titles from the Query+ AutoChart definition  <br> 1 - Use chart format/titles from the control definition |
|  | *var_iol$* | ***(Optional)*** Compiled IOList of variables to be passed to the Load logic. *(added in PxPlus 2019 Update 1)* |
|  | *var_rec$* | ***(Optional)*** Values of variables in the IOList derived by REC(*var_iol$***)**. *(added in PxPlus 2019 Update 1)* |
|  | *stmtref* | Error transfer. |

Plus charts may also be auto-loaded. To do this, instantiate the **[\*OBJ/CHART](https://manual.pvxplus.com/utilities/chart-object)** object and load it using the CALL to **\*tools/chartimage**. Once loaded, use the **[Draw( )](https://manual.pvxplus.com/utilities/chart-object#methods)** method to display the chart. When done, drop the chart object:

```
oChart=new("*obj/chart")
call "*tools/chartimage","Salesqry","query.en","Sales by Class",oChart,0
oChart'Draw(0,5,5,40,15)

drop object oChart
```

*(The \*tools/chartimage program was added in PxPlus 2019.)*
