Jump to content

TUniMemo: Monitored key is ignored F5


Recommended Posts

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();
        }
    })
});

 

Link to comment
Share on other sites

Config:

 

image.png.84cca5f938e1e6223595800743c367ee.png

 

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();
        }
    })
});
Link to comment
Share on other sites

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;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...