avj
asked on
Delphi Programming question
Is it possible to make a DBEdit field to automatically exit to the next field (like pressing tab) as soon as it is totally filled? DBASE used to do that automatically.
Answer gotten and rated:
Proposed Answer from ptiemann...
yes, it is possible :-)
You have to write some eventhandler for the OnChange event. The following code exits to the next field when you have reached 12 characters.
You may derive your own component from TDBEdit that does this automatically so you don't have to code it for each control separately.
<code snipped>
Ok, (itamar) mentioned another solution to which I ofcourse also am interested. Other opinions are also welcome.. Fire away :)
Answer gotten and rated:
Proposed Answer from ptiemann...
yes, it is possible :-)
You have to write some eventhandler for the OnChange event. The following code exits to the next field when you have reached 12 characters.
You may derive your own component from TDBEdit that does this automatically so you don't have to code it for each control separately.
<code snipped>
Ok, (itamar) mentioned another solution to which I ofcourse also am interested. Other opinions are also welcome.. Fire away :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well, I think we have another question here, or at least an increased value ;)
Anyway, did you try to uncheck the 'Save literals characters' option ?
Anyway, did you try to uncheck the 'Save literals characters' option ?
ASKER
Save literals is unfortunately also needed in this case..
Couldn't it be something like that ?
>>>
procedure TForm1.DBEdit1Change(Sende r: TObject);
begin
With Sender as TDBEdit do begin
if (Length(Text) = Field.DataSize) and <ADDITIONAL TEST> Then
ActiveControl := TWinControl(Components[Com ponentInde x + 1]);
end;
end;
Where in <ADDITIONAL TEST> you could check if the last position of the text is NOT the constant of mask.
>>>
procedure TForm1.DBEdit1Change(Sende
begin
With Sender as TDBEdit do begin
if (Length(Text) = Field.DataSize) and <ADDITIONAL TEST> Then
ActiveControl := TWinControl(Components[Com
end;
end;
Where in <ADDITIONAL TEST> you could check if the last position of the text is NOT the constant of mask.
ASKER