DelphiVCL4Python icon indicating copy to clipboard operation
DelphiVCL4Python copied to clipboard

Form loses focus after OpenDialog closes

Open zeo101 opened this issue 3 years ago • 5 comments

Hi everyone, I wrote a small multi form program to stamp, split or combine pdfs using pikepdf: These forms are called using:

def openStamper(self, Sender):
   form_stamper = Stamper_Form(Application)
   form_stamper.Show()

pdftool

If I click on "PDF auswählen" an OpenDialog shows up, that lets me pick the file which should get stamped using:

def btn_openpdfClick(self, Sender):
    self.OpenDialog1.Execute()                                              # Show open dialog to pick a file
    self.pdf_path = self.OpenDialog1.FileName                               # Get file path from open dialog
    self.edit_pdf.Text = self.pdf_path                                      # Show PDF path in disabled edit field

After choosing "open" in the dialog, the pdf_path is set correctly according to the selected file, but the stamper window loses focus and disappears behind the next open window on the desktop: pdftool2

This is really annoying especially when the other program is in fullscreen mode. Is there any possibility to focus the window again after the OpenDialog closes?

zeo101 avatar Jun 08 '22 10:06 zeo101

Hi @zeo101, thank you for pointing the concern. Let me reproduce your issue and will get back to you.

Priyatham10 avatar Jun 09 '22 04:06 Priyatham10

Hi @zeo101,

can you share a sample code reproducing this behaviour?

lmbelo avatar Jun 09 '22 13:06 lmbelo

Hey @lmbelo, I created a small form with delphi 10.4 where I experienced the same behavior as with the multi form programm: opendialog-test-py.zip

Using: Windows 10 Python 3.9.6 Delphi 10.4 Version 27.0.40680.4203 Delphi4Python Exporter 1.2.0 delphivcl==0.1.40

zeo101 avatar Jun 09 '22 13:06 zeo101

Thank you @zeo101,

we will figure out this problem.

lmbelo avatar Jun 09 '22 14:06 lmbelo