Jump to content

Form's OnKeyDown Event No Longer Handled After Button(s) In UniPdfFrame Clicked


Frederick

Recommended Posts

In my form's OnKeyDown event, I check for the pressing of the ESCAPE key to close the form. Before button(s) of the TUniPdfFrame component are clicked, pressing the ESCAPE key will be trapped. However, after button(s) of the TUniPdfFrame are clicked, the OnKeyDown event is no longer handled.

Why does this happen?

--
Frederick
(UniGUI Complete - Professional Edition 1.90.0.1510)
 

Link to comment
Share on other sites

6 minutes ago, Frederick said:

What code should I create and from which event?

Try this as an approximate solution.

pdfFrame.OnFrameLoaded event:

procedure TMainForm.pdfFrameFrameLoaded(Sender: TObject);
begin
  pdfFrame.JSInterface.JSCode(#1'.iframe.contentDocument.addEventListener("keydown", function(e){ajaxRequest('+ Self.WebForm.JSForm.JSName +', "keydown", ["key="+e.keyCode])});')
end;

 

  • Upvote 1
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...