SISBLU Software Posted April 4 Share Posted April 4 In my form I have been monitoring the F5 key and calling a function. But if I'm inside UNIMEMO and press the F5 key, the system restarts. I need to be OUTSIDE UNIMEMO for the F5 key to call the function Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 4 Share Posted April 4 Hello, 13 minutes ago, SISBLU Software said: In my form I have been monitoring the F5 key and calling a function. But if I'm inside UNIMEMO and press the F5 key, the system restarts. I need to be OUTSIDE UNIMEMO for the F5 key to call the function Can you make a simple testcase to check !? Also you can use this approach: MainForm.Script -> Ext.onReady(function() { document.addEventListener('keydown', (e) => { e = e || window.event; if (e.keyCode == 116) { e.preventDefault(); } }) }); Quote Link to comment Share on other sites More sharing options...
SISBLU Software Posted April 4 Author Share Posted April 4 Config: If I enter any MEMO and press F5 the system does RELOAD If I am OUTSIDE the memo and press F5, then the system CALLS the function NOT WORK Function Ext.onReady(function() { document.addEventListener('keydown', (e) => { e = e || window.event; if (e.keyCode == 116) { e.preventDefault(); } }) }); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 4 Share Posted April 4 Just now, SISBLU Software said: NOT WORK Make a simple testcase to reproduce. Also specify which browser? Quote Link to comment Share on other sites More sharing options...
SISBLU Software Posted April 4 Author Share Posted April 4 Chrome Quote Link to comment Share on other sites More sharing options...
SISBLU Software Posted April 4 Author Share Posted April 4 I discovered the error: If you leave this function on, when you enter MEMO and press F5, the system reloads 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...
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.