next up previous contents index
Next: The Escape key Up: Getting input from the Previous: Menus   Contents   Index


Entering and Editing arrays

CCATSL provides two useful routines allowing the user to enter and edit arrays of doubles and ints: EditDoubleArrayCL and EditIntArrayCL.


EditDoubleArrayCL

This routines displays a two-dimensional double array in a CCATSL window and gives the user the opportunity to edit the entries.

  void EditDoubleArrayCL ( int x,
  int y,
  int field,
  int ndec,
  two_d_double_array ap,
  int nrows,
  int ncols,
  int nTotalCols);

  x, y The text-coordinates of the position for the top-left corner of the array.
  field The field-width to use when printing each array entry.
  ndec The number of decimal places to display.
  ap The array of doubles, defined as type typedef double two_d_double_array[][].
  nrows, ncols The number of rows and columns to print. Usually nrows is the size of the first dimension in the declaration of the array ap, and ncols the second.
  nTotalCols The size of the second dimension in the declaration of the array ap.

For example:

  
..
{
  double r[5][10];
  EditDoubleArrayCL( 
                    1, 1,       /* print in the top-left corner */
                    4, 1,       /* field width and decimal places */
                    r,
                    5, 10, 10); /* array dimensions */
}


EditIntArrayCL

This routine displays a two-dimensional int array in a CCATSL window and gives the user the opportunity to edit the entries.

  void EditIntArrayCL ( int x,
  int y,
  int field,
  two_d_int_array ap,
  int nrows,
  int ncols,
  int nTotalCols);

  x, y The text-coordinates of the position for the top-left corner of the array.
  field The field-width to use when printing each array entry.
  ap The array of ints, defined as type typedef int two_d_int_array[][].
  nrows, ncols The number of rows and columns to print. Usually nrows is the size of the first dimension in the declaration of the array ap, and ncols the second.
  nTotalCols The size of the second dimension in the declaration of the array ap.

Example:

  
..
{
  double r[5][10];
  EditDoubleArrayCL( 
                    1, 1,       /* print in the top-left corner */
                    4, 1,       /* field width and decimal places */
                    r,
                    5, 10, 10); /* array dimensions */
}

If the array has only one dimension pass its address:

  
..
{
  double r[5][10];
  EditDoubleArrayCL( 
                    1, 1,       /* print in the top-left corner */
                    4, 1,       /* field width and decimal places */
                    r,
                    5, 10, 10); /* array dimensions */
}


next up previous contents index
Next: The Escape key Up: Getting input from the Previous: Menus   Contents   Index
CATAM admin 2010-02-23