Difference between revisions of "TGGrid"
Line 29: | Line 29: | ||
* Appending : one empty row will be always present at the bottom. When it is completed and valid, a new one is created, and so on. An event can be defined to fill default values in cells. | * Appending : one empty row will be always present at the bottom. When it is completed and valid, a new one is created, and so on. An event can be defined to fill default values in cells. | ||
− | * Inserting : use the F8 key to insert a row before the | + | * Inserting : use the F8 key to insert a row before the current one, or F9 to insert after the current one. An event can be defined to fill default values in cells. |
* Deleting : F10 deletes the current row. An event can be defined to ask for confirmation and/or prevent deletion of the line. | * Deleting : F10 deletes the current row. An event can be defined to ask for confirmation and/or prevent deletion of the line. | ||
Revision as of 21:35, 2 July 2013
It is a descendant of TStringGrid with more functionnalities.
Translation
You must create and give an english title to columns. This title will be used to get the translated title from the language inifile. For this it must contain a key with the TGGridName, a dot, the original column title, a dot, and the keyword Caption
Example :
[FormXXXX]
Grid1.FirstColumn.Caption=Première colonne
Grid1.SecondColumn.Caption=Deuxième colonne
Column widths
The program can (and should) autosize after the grid is filled, or after change in cell's length .
If the user change the widths of columns, they will be stored in the configuration on exit and restored next time the program runs. In the future, we plan to memorize the order of the columns, allow hiding some of them, and resetting all.
Row insertion and deletion
If the property Readonly is true, the following is of course not relevant.
The property GOptions allows or not adding a row at the bottom, inserting a row, and deleting a row.
- Appending : one empty row will be always present at the bottom. When it is completed and valid, a new one is created, and so on. An event can be defined to fill default values in cells.
- Inserting : use the F8 key to insert a row before the current one, or F9 to insert after the current one. An event can be defined to fill default values in cells.
- Deleting : F10 deletes the current row. An event can be defined to ask for confirmation and/or prevent deletion of the line.
In addition to the Lazarus TStringGrid.OnValidate, there is an OnValidateRow event, which can be called if you need to validate globally the line.
Public methods
Some public methods are available, in addition to those of TStringGrid, to help managing the grid.