list_view2

Displays the contents of a list, allowing multiple items to be tagged.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X X X   X

Syntax

void list_view2(list-name,row,col,size,exit-key[,view-col,...])
list            list-name
int             row,col,size,exit-key
expr            view-col

Description

list-name specifies the list to display.

row specifies the row position for the displayed window. -1 places the upper left of the box at the cursor position. -2 places the box in the center of the screen.
col specifies column location of the view box; -1 places the upper left of the box at the cursor position. -2 places the box in the center of the screen.

size specifies the number of rows to display; if it is -1, the function displays as many rows as will fit.

exit-key specifies the key that exits the view.

view-col (optional) specifies which columns to display. Please refer to list_view's definition of view-col for more details. The default is all columns.

Notes

In addition to the list_view() selection ability, this function allows you to specify the view box location and the number of rows to display, and choose an exit key for the application.
The item's status toggles between item-tagged and item-select and the last tagged item becomes the current item pointer.
In character mode, the Spacebar toggles the current item, and Enter and exit_key simply return.
list_view3 adds an abort option, lets you define display options, and lets you choose the column to return.

Example

Creates a delete utility that prompts for file names:
  list files;
  char fn[80];
  int  cnt;

  fn = tmpnam();
  system("ls > " ^^ fn);
  files = list_open(fn,1000,"Hit Enter to tag a file for delete");
  list_view2(files,5,5,10,key_f3);
  cnt = list_rows(files);
  list_seek(files,0);
  while (cnt) {
    if (list_stat(files) == item_tagged) delete(list_curr(files,0));
    list_next(files);
    cnt--;
    }
  delete(fn);
  }