GRID.PutArray

Previous  Next

 

state = GRID.PutArray(  BYVAL nControl AS INTEGER,

                        BYREF out      AS ARRAY,

                       [BYVAL startrow AS INTEGER = -1],

                       [BYVAL startcol AS INTEGER = -1],

                       [BYVAL endrow   AS INTEGER = -1],

                       [BYVAL endcol   AS INTEGER = -1],

                       [BYVAL offset   AS INTEGER = 0]   ) AS INTEGER

 

 

 

 

Puts an entire 2D array to the Grid.  If the supplied array has more than 2 dimensions, then the function will convert the array internally to a 2D array by merging the lower dimensions.  For example, an array dimensioned as (100, 4, 3) will be merged into (100, 12) array.

 

Example:

 

SUB DeleteAllItems( nControl AS INTEGER )

  DIM i AS INTEGER

  FOR i = 1 TO GRID.ColumnCount( nControl )

     GRID.DeleteColumn( nControl, i )

  ENDFOR

END SUB

 

SUB InitGrid( nControl AS INTEGER )

  CALL DeleteAllItems( nControl )

  GRID.ColumnResize( nControl, FALSE );

  GRID.RowResize( nControl, FALSE );

  GRID.EnableSelection( nControl, FALSE );

  GRID.Editable( nControl, FALSE );

  GRID.FrameFocusCell( nControl, FALSE );

  GRID.SetDefaultFormatString( nControl, MG_CELL_INTEGER, "%1.2f" )

  GRID.RowCount( nControl, 10 )

  GRID.ColumnCount( nControl, 2 )

  GRID.RowHeight( nControl, 1, 32 )

  GRID.ItemLong( nControl, 1, 1, 12 )

  GRID.Refresh( nControl )

  PRINT "Control ";nControl;" >>> ";GRID.RowCount( nControl );", ";GRID.ColumnCount( nControl ),

END SUB

 

FOR i = 1 TO 2

  FOR j = 1 To 10

     arr5(j,i) = n + ( j / 10 ) - ( j / 100 )

     n = n + 1

  ENDFOR

ENDFOR

 

CALL InitGrid( nControl )

GRID.PutArray( nControl, arr5, 1, 1, 10, 2 )