Forum > Windows
How do I use Enter key i/o Tab to traverse between textboxes in a form
(1/1)
Goodman H__:
Greetings to everybody!
In Delphi I can write code in form's keyPress event(set form's keypreview:=true):
--- Code: ---if key=#13 then
perform(wm_nextDlgCtrl,0,0);
end;
--- End code ---
How can I do the same in FP?And what's the cross-platform solution also?
Thanks a lot for your help in advance.
Regards,
Sam
theo:
--- Code: ---uses LCLType;
procedure TForm1.FormKeyDown(Sender:TObject;var Key:Word;Shift:TShiftState);
begin
if Key=VK_Return then SelectNext(ActiveControl,True,True);
end;
--- End code ---
zeljko:
--- Quote from: Goodman H__ on May 22, 2010, 04:38:01 am ---Greetings to everybody!
In Delphi I can write code in form's keyPress event(set form's keypreview:=true):
--- Code: ---if key=#13 then
perform(wm_nextDlgCtrl,0,0);
end;
--- End code ---
How can I do the same in FP?And what's the cross-platform solution also?
if Key = #13 then
SelectNext(ActiveControl, True, True)
Regards,
Sam
--- End quote ---
Goodman H__:
--- Quote from: theo on May 22, 2010, 04:46:42 am ---
--- Code: ---uses LCLType;
procedure TForm1.FormKeyDown(Sender:TObject;var Key:Word;Shift:TShiftState);
begin
if Key=VK_Return then SelectNext(ActiveControl,True,True);
end;
--- End code ---
--- End quote ---
Thank you.It works.
But there is a little difference.Based on the above code,all controls can traverse by enter key with no problem,but when nagivate to a button,press enter does not fire the button's event,just go to the next control.If I want to fire the button's event,I need to press blank key.Not the same in delphi though,but it works.
Navigation
[0] Message Index