d.bernaert Posted December 23, 2018 Share Posted December 23, 2018 Hello, I would like to trap the enter key for saving a record in an update screen. This works fine when trapping the #13 key. But I would also like to be able to keep using the enter key in a memo or html edit control without invoking the #13 key on form level. Is that possible? Thx, Dominique Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 23, 2018 Share Posted December 23, 2018 Hello, If I didn't understand correctly, please specify, but this post can help you: Quote Link to comment Share on other sites More sharing options...
d.bernaert Posted December 23, 2018 Author Share Posted December 23, 2018 Hi Sherzod, I have the property on the form set to 13 -> submit. When I'm in a unidbmemo and I press enter, it fires the submit, posting the record in the database. I've added the following function in the Keydown in extEvents: { if (e.getKey() == e.ENTER) { e.stopPropagation(); } But it still executes the submit. Thx, Dominique Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 23, 2018 Share Posted December 23, 2018 Hi, I will check, but if possible, can you make a simple testcase for this?! Quote Link to comment Share on other sites More sharing options...
d.bernaert Posted December 24, 2018 Author Share Posted December 24, 2018 Hi Sherzod, here included a small testcase. Grtz. Dominique TestReturn.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 24, 2018 Share Posted December 24, 2018 Hi, Can you try this approach for now? procedure TUniForm1.UniFormReady(Sender: TObject); begin UniMemo1.JSInterface.JSCode(#1'.inputEl.dom.addEventListener("keydown", function(e){e.stopPropagation()});'); end; Quote Link to comment Share on other sites More sharing options...
d.bernaert Posted December 24, 2018 Author Share Posted December 24, 2018 Solved this way, thx Sherzod. Dominique Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.