Navigation:  Reference > Commands >

Data Grid Update

Print this Topic Previous pageReturn to chapter overviewNext page

 

Use this command to manipulate the columns in a TTASDataGrid object on the form.

 

DATA_GRID f/c/e Required - The name of the TTASDataGrid object on the form

 

MOVECOLUMN  Move a column to the first column position.  All columns after that will be moved one to the right.

 

SHIFTCOLUMN  This will exchange two columns in the grid.  The column specified by NAME will be exchanged with the column specified in TO.

 

CLEARRemove all the columns from a grid.  If the grid is active you should use the appropriate CLOSE option in WLISTF or WLISTM before this option.

 

GOEDITPut the grid in edit mode.  This means you will allow the user to change values in the columns for a particular row or record.  The user must move from the row being edited to a different row (even if it means adding a new row) before the changes are saved to a record or the array element.

 

GOROWSELECT  Change from edit mode back to row select mode.  In this mode the select bar will stretch over the entire row and the user will not be able to make changes to individual column values.

 

NEWCOLUMN Add a new column to the grid using the TEMPLATE option to specify the column to add and NAME for the column name.

 

GETCOLUMNGet a copy of a column in the grid and put it in the TEMPLATE object.  This will not remove the column from the grid, just gets a copy.

 

DELETECOLUMN  Remove a column from the grid.  You must specify the name of the column to be removed in the NAME option.

 

UPDATECOLUMN  Using the TEMPLATE object update the values in the column specified in the NAME option.

 

GETARRAYFLDS  Use this option to get an array of the field names in current column order.  These values will be saved in the field specified in RECVFLD.  The receiving field must have enough array elements to store all the column fields or you will receive a single field with the value 'Need more elem'.

 

GETARRAYCOLS  Use this option to get an array of the column names in current column order.  These values will be saved in the field specified in RECVFLD.  The receiving field must have enough array elements to store all the column names or you will receive a single field with the value 'Need more elem'.

 

ADDROWAdd a new row to the end of the grid list.  This should be used for both Array Lists (WLISTM) and File Lists (WLISTF). NOTE: Must have GoRowSelect set to true or RWN program may hang. See Example 2

 

INSERTROWInsert a new row at a point in the grid list.  This only applies to Array Lists (WLISTM).  If you want to specify a row to be inserted before then put that row number in the NUM option (see below).  If there is no NUM option specified the row will be inserted before the current active row. NOTE: Must have GoEdit set to true or insert will not occur. See Example 2

 

DELETEROWDelete a row from either a Array List (WLISTM) or File List (WLISTF) grid.  This will allow you to delete a row (including the appropriate array elements or record) by program control.  This would be the same as if the user pressed the DEL key. See Example 2

 

MOVETOROWMove the cursor to a specific row in the list.

 

       NOTE:  You can only move to a row displayed on the screen.  This is not the method to move to a specific row in the file or array.  For example, if there are only 10 rows displayed on the screen then you can only move to rows 1 through 10.  If you want to move to a specific row in the file/array then make that record active and do a WLISTF .... REDISPLAYACTIVE or reset the counter value and do a WLISTM .... REDISPLAYCURRENT or REDISPLAYACTIVE.

 

SAVEGRIDREC Use this option to save the current active record to disk.  This would save the record even if the user doesn't move to a different row.  Works only with WLISTF type grids.

 

DELETEGRIDREC  This is similar to DELETEROW above, except that you don't need to specify the Row value.  It will delete the current active record and redisplay the grid.  Works only with WLISTF type grids.

 

LOCKThis option will cause the grid to ignore any auto refresh calls from the program.  This would be similar to setting the NO_REFRESH property in the form to TRUE, except it only applies to the specific TTASDatagrid.  To reset the grid to normal mode see the UNLOCK option.

 

UNLOCKThis will return the data grid to normal mode (turn off the LOCK option above) in that it will automatically show updates when you read records in the program.

 

NAME f/c/eThis is the column name.  In options NEWCOLUMN, GETCOLUMN, DELETECOLUMN, MOVECOLUMN, SHIFTCOLUMN and UPDATECOLUMN this is a Required value.

 

TO f/c/eThis is the column number.  In option SHIFTCOLUMN this is the column number that will be exchanged with the column specified in NAME.  This is a Required value for SHIFTCOLUMN.

 

NUM f/c/eIn options GETCOLUMN and UPDATECOLUMN you can specify the column number instead of the column name.  You must specify one or the other.  In the MOVETOROW option this is the row number you want to move to.

 

TEMPLATE f/c/e  This is the name of the TTASDGColTemplate object that will be used in options NEWCOLUMN, GETCOLUMN and UPDATECOLUMN.  It is Required for those options.

 

RECVFLD fn/vThe name of the array field Required in options GETARRAYFLDS and GETARRAYCOLS.

 

COMMENTS

This command can be used on both active and inactive grids.  Through the use of DATA_GRID you can allow the user to determine which columns show up, in what order, and even, if you want to get that complex, what the headers are, colors, etc.

 

EXAMPLE

A very good example of this command is WTASDATAM.  The source file (WTASDATAM.SRC) should be in the \TAS7 subdirectory depending on where you installed TAS Professional.

 

EXAMPLE 2

insert row and delete row

Insetrow.click:      

    data_grid 'Grid2' GoEdit //Or Insert will not occur

    data_grid 'Grid2' InsertRow

    data_grid 'Grid2' GoRowSelect

    ret

 

deleterow.click:

    data_grid 'Grid2' GoRowSelect

    data_grid 'Grid2' DeleteRow // Must be in row select mode or it hangs! 

    data_grid 'Grid2' GoEdit

    ret

 

Above sample2 information supplied by TAS professional End user.

 

Advanced Data Grid Sample Move to row

 

Grid1.Select:

            // Processing code here like

            form1 = LOAD_MODAL_FORM('MYFORM')

 

             wlistf 'grid1' refreshrecord

             define rowno type i size 5

// Here is what We wanted to show you in this case the user click on this and when they were done the grid 

// was refreshed and the position on the grid was moved one row down with the movetorow

             rowno =  get_obj_prop('grid1','currentrow')  // here we get the row number we are on when they click

             rowno = rowno + 1

             if rowno = 11 do  // since there are only 11 displayable rows we do h=it like this..

                wlistf 'grid1' redisplayactive

                rowno = 2

             endif

             data_grid 'grid1' movetorow num rowno

             while bkap.rpo.pcode = ''

                   rowno = rowno + 1

                   if rowno = 11 do

                      wlistf 'grid1' redisplayactive

                      rowno = 1

                   endif

                   data_grid 'grid1' movetorow num rowno

             endw

             Set_focus 'grid1'

             ret

 

 

 

 

 

 


Page url: http://www.cassoftware.com/tas/manual/datagridupdate.htm