Allow access to the contents of the editor while a cell is being edited. This is original not provided. I need this for a specific application, but I didn't want to interfere with the existing components. So I developed the derived components TRxDBGridNew and TDBGridNew to be able to do this.
Access can be helpful, for example, if you want to search based on the current input in a higher-level table using Locate.
All of this is available for download as a sample program as a zip file.
The components are located in the “NewDBGridsPackages” directory and can be installed with “lem.lpk”. These then appear in the “Lem” tab.
I haven't put any effort into the icons at the moment. But I am sure that these component derivatives will have some additions and then there will also be appropriate icons.
The example program is in the test program directory.
procedure TForm1.DBGridNew1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
Begin
{ Um unten immer die aktuellen Daten anzuzeigen }
{ To show always the correct data }
Label1.Caption:= '';
Label2.Caption:= '';
Label3.Caption:= '';
{ Der momentan im Editor geänderte Text }
{ The changed text in the editor }
Label1.Caption:= DBGridNew1.EditedValue;
{ Das verwendete Datenbankfeld }
{ The active database field }
Label2.Caption:= (Sender as TDBGridNew).SelectedField.FieldName;
{ Reaktion auf ein bestimmtes Feld }
{ Reaction of a concrete field }
if Label2.Caption= 'FieldB' then Label3.Caption:=
'Treffer/FieldB: '+DBGridNew1.EditedValue;
end;
Here, in the KeyUp event, the new editor content is adopted using “EditedValue” (DBGridNew1.EditedValue) and then displayed. The KeyDown and KeyPress events provide the content before the change. The last edited value remains until it is edited again or the x/y position in the (Rx)DBGridNew is changed. This can be checked by clicking on “Value Now”. By querying the field name, you can react specifically to individual columns, even if they are moved in the grid.
The whole thing is self-explanatory in the example program.
If you don't use one of the two grids, you can exclude it. I added DBGrid because I think it will be used a lot.
The download is on the end of this site (same text as above in German):
https://lazarus.intern.es/erweiterung_dbgrid_rxdbgrid.htmlThe translation was made with Googl Translate, I hope it is useful.