|Subject:||StringGrid: how to set MaxLength for a specific Column|
|Posted by:||Gerhard Zampich (ma…@Zampich.de)|
|Date:||Fri, 04 Jul 2008|
I am trying to limit the data entry in a column of a stringgrid to a
I have done the following:
TStringGridCracker = class(TStringGrid)
procedure TMainForm.GridSetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: String);
if ( ACol = 5 )
do if (InplaceEditor <> nil
then TEdit(InplaceEditor).MaxLength := 55;
This works good, with one exception:
When the cell at column 5 holds already 55 chars when the cell is
selected, one can enter a 56th character.
So it seems that the SetEditText event is to late to set maxlength.
What is the correct way to set TEdit(InplaceEditor).MaxLength?