Forum Discussion

schwarz's avatar
schwarz
Occasional Contributor
10 years ago

Modal dialog is sometimes not focused after it´s opened

Hi all,

 

Sometimes we are running into this problem:  TestExecute opens a modal dialog (e.g. a properties dialog) on the main form of our application. After that, the main form is still focused, and the modal dialog is on top of it (Sys.Desktop.ActiveWindow returns the main form in this case). Expected behaviour is that the modal dialog is focused.

When I try this manually, the modal dialog will always be focused (and it is impossible to focus the main form) as intended.

This occurs for .NET and Delphi applications, TestExecute version is 10.5.

 

Does anyone have an idea what could cause this? This behaviour does not always occur.

 

Best regards

 

Jens

 

 

3 Replies

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor

    We had a similar issue with Delphi apps, but TestComplete was not the cause.

    Instead it was an issue with Delphi/Windows which was exposed by the "speed" in which TestComplete clicked through various windows. The fix was to add to the Delphi application two things:

     

    form.PopupMode := pmExplicit;
    form.PopupParent := frmMyFormName;

     

    This assumes you do not have a line of code that explicitly sets focus back to the main form with the .Focus() method;

    and that you are not attempting to click back to the main form prior to closing the modal window or dialogue.

  • schwarz's avatar
    schwarz
    Occasional Contributor

    Hi Ryan,

     

    thanks for your answer. We will try this for one of our products and hope that this issue will be solved.

    Do you know how to handle this in .NET ?

     

    Best regards

     

    Jens

    • Ryan_Moran's avatar
      Ryan_Moran
      Valued Contributor

      We only saw this with one form in one of our .NET applications and the programmer did not supply the fix, sorry.

      I'd start with the fix I supplied for your Delphi app and if that proves to correct the issue I'm sure the equivelent for .NET could be found with a google search.