Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TAdvStringGrid
Setting different max. edit lengths for the inplace editor

If the max. number of characters for editing should be limited, this can be done with then LengthLimit property of the inplace editor. When LengthLimit is 0, there is no limitation to the nr. of characters that can be typed in the editor. To set a different max. nr of characters per column, following code can be used in the OnGetCellEditor event :
procedure TForm1.AdvStringGrid1GetEditorType(Sender: TObject; ACol,
ARow: Integer; var AEditor: TEditorType);
begin
  if Assigned(AdvStringGrid1.NormalEdit) then
  begin
    case acol of
    1:AdvStringGrid1.NormalEdit.LengthLimit := 4;
    2:AdvStringGrid1.NormalEdit.LengthLimit := 8;
    else
      AdvStringGrid1.NormalEdit.LengthLimit := 0
   end;
  end;
end;
This sets the max. edit length for column 1 to 4 characters, for column 2 to 8 eight characters and unlimited for all other columns.