TomazB
asked on
Moving trough components
I have app with a few forms with lot of controls for data input (text or numbers). Is there any simple way to switch amongst them (to make them active) while entering data. Tab is clumsy becouse of large number of controls. I would need something like arrow keys that moves focus to nearest component in any direction. Perhaps someone have code already writen?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
this works great for edit's and memo's
Force Accepted
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange
edit1.SetFocus;
e.g. you must enter a valid zip in edit1 to go tho the next thing
procedure jada1.OnkeyUp(jadajadajada
Begin
if length(edit1.Text)=4 {and ValidateZip(Edit1.text)} then button1.SetFocus;
end;
or with the arrows
procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
var d,e:Tcontrol;
i:integer;
begin
if ssShift in shift then
Begin
d := TControl(sender);
for i:=0 to d.parent.controlcount-1 do
find best one fitting to key by using d.left en d.top
e.setfocus;
if key = vk_up then
end;
end;