Jump to content

How To Press ESCAPE To Close Form When Focus Is On TUniPDFFrame?


Frederick

Recommended Posts

I have a form with a TUniPDFFrame and where there is the following code entered in the OnKeyDown event of the form.

procedure TForm.UniFormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
   if Key=VK_ESCAPE then
      close;
end;

When the form starts and a PDF file is displayed within the TUniPDFFrame, I can press the ESCAPE key and the form closes.

However, when I click the Print button of the TUniPDFFrame, view the result, press the ESCAPE key to close it and then press the ESCAPE key again to close the dialogue box for generating the document, pressing the ESCAPE key for the third time does not close the form.

Why does the final ESCAPE key press not close the form?

--
Frederick
(UniGUI Complete - Professional Edition 1.90.0.1534)
 

tunipdfframe_escape.png

Link to comment
Share on other sites

Sherzod,

I noticed that when the ESCAPE key is pressed at the dialogue box for document printing, this dialogue box plus the print preview screen of the TUniPDFFrame closes as well.

Is it possible to just close the dialogue box first and then another ESCAPE key will close the print preview screen? The user may want to choose another option from TUniPDFFrame.

Without the JS code, pressing the ESCAPE key closes the dialogue box but not the print preview screen.

Link to comment
Share on other sites

25 minutes ago, Frederick said:

I noticed that when the ESCAPE key is pressed at the dialogue box for document printing, this dialogue box plus the print preview screen of the TUniPDFFrame closes as well.

Is it possible to just close the dialogue box first and then another ESCAPE key will close the print preview screen? The user may want to choose another option from TUniPDFFrame.

Without the JS code, pressing the ESCAPE key closes the dialogue box but not the print preview screen.

If possible, can you attach screenshots, the sequence of your actions?

Link to comment
Share on other sites

6 hours ago, Sherzod said:

If possible, can you attach screenshots, the sequence of your actions?

In the first video, the TUniPDFFrame does not have anything in the OnFrameLoaded event. When the ESCAPE key is pressed when the dialogue box is visible, the dialogue box closes, leaving the print preview showing. However, pressing the ESCAPE key at the print preview screen does nothing.

In the second video, the OnFrameLoaded event has the JS code and when the ESCAPE key is pressed, BOTH the dialogue box and form closes. What I want is when the ESCAPE key is pressed at the dialogue box, it closes and the print preview window remains. (This is similar to clicking the Done button of the dialogue box) Then, when I press the ESCAPE key again, the form closes.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...