Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 4 of 4 total |
Catching the return key within a form |
Fri, Nov 3 2017 4:55 PM | Permanent Link |
Richard Mace | Hi,
I am wanting to detect the return key so that I can assume that the user wants to effectively press the OK button on a form. What's the best way of doing this? Thanks |
Sun, Nov 5 2017 4:58 PM | Permanent Link |
Howard Chandler Fiscalsoft Corporation | Richard,
> I am wanting to detect the return key so that I can assume that the user wants to effectively press the OK button on a form. > > What's the best way of doing this? You can use the form's OnKeyPress event: function TFrmMainForm.FrmMainFormKeyPress(Sender: TObject; Key: Char; ShiftKey, CtrlKey, AltKey: Boolean): Boolean; begin if (Key = #13) then OKButtonClick(Self); end; Howard |
Sun, Nov 5 2017 6:40 PM | Permanent Link |
Howard Chandler Fiscalsoft Corporation | Richard,
> >> I am wanting to detect the return key so that I can assume that the >> user wants to effectively press the OK button on a form. >> >> What's the best way of doing this? > > You can use the form's OnKeyPress event: > > function TFrmMainForm.FrmMainFormKeyPress(Sender: TObject; Key: Char; > ShiftKey, CtrlKey, AltKey: Boolean): Boolean; > begin >  if (Key = #13) then >  OKButtonClick(Self); > end; > > Howard Sorry, it's a function in EWB so we need to include a Result: function TFrmMainForm.FrmMainFormKeyPress(Sender: TObject; Key: Char; ShiftKey, CtrlKey, AltKey: Boolean): Boolean; begin  if (Key = #13) then  OKButtonClick(Self);  Result := True; end; Howard |
Mon, Nov 6 2017 3:54 PM | Permanent Link |
Richard Mace | Chandler wrote:
<< Sorry, it's a function in EWB so we need to include a Result: function TFrmMainForm.FrmMainFormKeyPress(Sender: TObject; Key: Char; ShiftKey, CtrlKey, AltKey: Boolean): Boolean; begin  if (Key = #13) then  OKButtonClick(Self);  Result := True; end; Howard >> Perfect, thanks howard. Richard |
This web page was last updated on Friday, April 19, 2024 at 07:09 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |