The MaxLenght property of a TCustomEdit descedant components (TEdit, TDBEdit, ...) specifies the maximum number of characters the user can enter into the edit control.
Here's how to move immediately to the next control (in the tab order) when the max character length has been met:
~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm1.Edit1Change(Sender: TObject) ;
begin
if Sender is TCustomEdit then
with Sender as TCustomEdit do
if MaxLength = GetTextLen then
self.SelectNext(TCustomEdit(Sender), true, true) ;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
Note 1: the above code is a handler of the OnChange event of an edit control named Edit1.
Note 2: MaxLength property is ideally used in database applications where MaxLength of a TDBEdit component matches a TField's Size property (for string type fields).
More TEdit tips: "Use arrow keys to move between controls" and "Using the ENTER key as TAB".
Delphi tips navigator:
» How to handle the TMaskEdit's internal "Invalid input value. Use escape key to abandon changes" error in Delphi
« Raising TPageControl's OnChagning and OnChange events from code

