![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 7 of 7 total |
![]() |
Thu, Feb 28 2013 12:42 PM | Permanent Link |
Matthew Jones | I'm trying to have the Enter key to "default" a button press after the user has
entered a value. I can't get it working though. function TfrmJoin.frmJoinKeyDown(Sender: TObject; Key: Integer; ShiftKey, CtrlKey, AltKey: Boolean): Boolean; begin lblInfo.Caption := 'Mum!'; Result := true; if (Key = 13) {and btnJoin.Enabled} then begin lblInfo.Caption := 'Hello!'; Result := false; btnJoinClick(nil); end; end; If I put the same code in the KeyPress (but with #13) then nothing happens either. What am I doing wrong? KeyPreview is set. It doesn't work on IE or Chrome. Hmm, well, IE seems to hang, but that may be something else. /Matthew Jones/ |
Tue, Mar 5 2013 1:13 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< I'm trying to have the Enter key to "default" a button press after the user has entered a value. I can't get it working though. >> I'm using the following in the IDE and it works (also tried it in FF and it works also): function TForm1.Edit1KeyDown(Sender: TObject; Key: Integer; ShiftKey, CtrlKey, AltKey: Boolean): Boolean; begin Result := true; if (Key = 13) then begin Result := false; Button3Click(nil); end; end; What is your button click event doing ? That might have something to do with things. Tim Young Elevate Software www.elevatesoft.com |
Mon, Mar 11 2013 1:35 PM | Permanent Link |
Matthew Jones | Ahah! I was about to send you a demo of my abject failure, and then I spotted the
difference. Me, I was using the FORM OnKeyDown event. You, you are using the edit OnKeyDown event. Makes a big difference! Okay, that's got me going, but you may want to look at the form version as it really doesn't get a lot of a look in, except occasionally, regardless of whether KeyPreview is true or false. /Matthew Jones/ |
Mon, Mar 11 2013 2:07 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< Okay, that's got me going, but you may want to look at the form version as it really doesn't get a lot of a look in, except occasionally, regardless of whether KeyPreview is true or false. >> Ahh, sorry about that. I just tried it here and it seems to work just fine with KeyPreview=True. Is your edit control on a panel, perhaps ? Each panel/form has its own KeyPreview property that can cut off/propagate the keys upward to the container. Tim Young Elevate Software www.elevatesoft.com |
Mon, Mar 11 2013 3:28 PM | Permanent Link |
Matthew Jones | > Is your edit control on a panel, perhaps ?
It is indeed. Another useful tidbit. /Matthew Jones/ |
Fri, Apr 4 2014 8:59 AM | Permanent Link |
Matthew Jones | > Is your edit control on a panel, perhaps ? Each
> panel/form has its own KeyPreview property that can cut > off/propagate the keys upward to the container. Tim, Could you emphasise this in the online help please? It is key information that is sort of there (the KeyPreview topic talks about "Panel" even for a form) but the hierarchy point is not clear. I only worked this out by searching here for KeyPreview. The help should mention the panels control it too, up to the form. /Matthew Jones/ |
Fri, Apr 11 2014 2:56 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< Tim, Could you emphasise this in the online help please? >> Yes, I'll add a note about this. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |