I developed an example of a dynamic GRID control.
I hope it is useful.
Code: Select all
// DESCRIPTION
*******************************************************************************
* DYNAMIC_GRID.PRG
* Illustrates the modification of a GRID control at runtime:
* Insert different types of columns (NUMERIC,CHARACTER,DATEPICKER,COMBOBOX,SPINNER,CHECKBOX)
* and Delete and Move columns.
*******************************************************************************
// PROCEDURES/FUNCTIONS
**********************************************************************************
* GRID_AddColumnEx ---> Complement of Method: cParentForm.cControlName.AddColumn ([nColIndex], [cCaption], [nWidth], [nJustify])
* GRID_DeleteColumnEx ---> Complement of Method: cParentForm.cControlName.DeleteColumn (nColIndex)
* GRID_ColumnCount ---> Return the Number of Column on GRID
* GRID_GetColumnControlsEx ---> Return Array with Controls of Column(nColIndex) ==> {aCOLUMNCONTROL, bDYNAMICBACKCOLOR, bDYNAMICFORECOLOR, bCOLUMNWHEN, bCOLUMNVALID, bONHEADCLICK}
**********************************************************************************
// SYNTAX
**********************************************************************************
* GRID_AddColumnEx (cControlName, [cParentForm], nColIndex, [aCOLUMNCONTROL], [bDYNAMICBACKCOLOR], [bDYNAMICFORECOLOR], [bCOLUMNWHEN], [bCOLUMNVALID], [bONHEADCLICK])
* GRID_DeleteColumnEx (cControlName, [cParentForm], nColIndex)
* GRID_ColumnCount (cControlName , [cParentForm])
* GRID_GetColumnControlsEx (cControlName, [cParentForm], nColIndex)
**********************************************************************************
for future versions of HMG, in GRID control: extend the number of controls in ADD / DELETE COLUMN (aCOLUMNCONTROL, bDYNAMICBACKCOLOR, bDYNAMICFORECOLOR, bCOLUMNWHEN, bCOLUMNVALID, bONHEADCLICK, etc.) and implement the property COLUMNCOUNT.
Best Regards,
Claudio Soto.