Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter NineDialog Functions (continued)

DataControlGetSelectList Function

Overview

The DataControlGetSelectList function retrieves the number of selected items as an array of rows and columns.

Syntax/Parameters

Syntax

int [][] = DataControlGetSelectList ( int id );

Parameters

id

An int containing the control ID of the data control.

Return Value

An int table containing the selected items within a data control, empty if none are selected, or empty on failure. Common error codes are as follows: ERROR_RANGE if id is an invalid control ID for the open dialog or ERROR_INVALID_HANDLE if no dialog is open. Use the GetLastError function to retrieve error information.

Remarks

The table returns is index as a table row for each selected item with the columns as “Row” and “Col” key names for the 0th and 1th positions, respectively. The number of select items can be obtained by getting the axis depth for the AXIS_ROW.

Returned values are zero-based. In row select mode, the all column fields are returned as -1.

An example of dumping selections from a select action.

int rc_action(int c_id, int c_action) {

    int                 list[200][2];
    int                 rows;
    int                 ix;
    int                 rc;

    if (c_id == LIST) {
      if (c_action == DCN_SELECT_CHANGE) {
        rc = DataControlGetSelectCount(LIST);
        if ((rc > 1) && (rc < 200)) {
          list = DataControlGetSelectList(LIST);
          rows = ArrayGetAxisDepth(list, AXIS_ROW);
          ConsolePrint("Select Data (total count %d):\n", rc);
          ix = 0;
          while (ix < rows) {
            ConsolePrint("   Row: %2d Col:%2d\n", list[ix][0], list[ix][1]);
            ix++;
            }     
          }
        }
      }
    return 0;
    }

LIST is predefined as the dialog control id for a data control. Resources and the DialogBox call is performed elsewhere. In the above action, the list of selected items is dumped to the console on each select change. Note that the list is limited to 200 to avoid constant allocation of an automatic table during the action processing since the action processor gets called frequently and may control actions. Also note, for illustration, the value rc should match rows.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic