Frederick Posted December 16, 2019 Share Posted December 16, 2019 When I am within a TUniDBMemo, I want to be able to press the ENTER key to insert a carriage return and line feed within the memo. Based on an earlier forum post, I entered the following:- UniDBMemo1 -> ClientEvents -> ExtEvents ... add keydown fn: function keydown(sender, e, eOpts) { if (e.getKey() == e.ENTER) { e.stopPropagation(); } } However, UniGUI is not responding to the above event. If the ENTER key is pressed within the memo, focus moves to the next component of the form. My form's KeyPreview is True while the NavigateKeys.Next.Key is set to 13. Setting the former to False or disabling NavigateKeys on entering the memo control does nothing. What am I missing here? -- Frederick (UniGUI Complete - Professional Edition 1.90.0.1514) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 17, 2019 Share Posted December 17, 2019 4 hours ago, Frederick said: When I am within a TUniDBMemo, I want to be able to press the ENTER key to insert a carriage return and line feed within the memo. Based on an earlier forum post, I entered the following:- UniDBMemo1 -> ClientEvents -> ExtEvents ... add keydown fn: function keydown(sender, e, eOpts) { if (e.getKey() == e.ENTER) { e.stopPropagation(); } } However, UniGUI is not responding to the above event. If the ENTER key is pressed within the memo, focus moves to the next component of the form. My form's KeyPreview is True while the NavigateKeys.Next.Key is set to 13. Setting the former to False or disabling NavigateKeys on entering the memo control does nothing. What am I missing here? -- Frederick (UniGUI Complete - Professional Edition 1.90.0.1514) Try this approach too: http://forums.unigui.com/index.php?/topic/8238-change-formnavigatekeys-at-runtime/&do=findComment&comment=55862 Quote Link to comment Share on other sites More sharing options...
Frederick Posted December 17, 2019 Author Share Posted December 17, 2019 Thanks. The following code works. UniMemo -> ClientEvents -> ExtEvents -> function afterrender(sender, eOpts) { sender.bodyEl.dom.addEventListener( 'keydown', function(e) {if (e.key=='Enter') {e.stopPropagation()}} ); } 1 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.