Embarcadero/DelphiVCL4Python

Form loses focus after OpenDialog closes

zeo101 opened this issue · 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?

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

Hi @zeo101,

can you share a sample code reproducing this behaviour?

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

Thank you @zeo101,

we will figure out this problem.

Hi everyone,
I experienced exactly the same issue.