Forum Discussion

googleid_114358's avatar
googleid_114358
Contributor
12 years ago

TestComplete ShowModal UserForms - Give focus to a button

Hi.



I created an UserForm within a script extension.

Everything works perfectly and this is a really awesome feature !



I am facing a small issue that would make the user experience even better. 

How can I give the focus to a specific component within a UserForm ?



I am actually trying to give the focus to a mrOk button, so the user would have to check the data display in the UserForm, and simply press [Enter] to add a specific Keyword operation : no interaction needed.



Didn't find anything regarding this in the TestComplete documentation.

Do you have any idea ?



I tried the UserForms.MyForm.btnApply.SetFocus() but thrown an exception as the MyForm modal window is not visible yet (I called the UserForms.MyForm.ShowModal afterwards...)



Regards, 



Guillaume
  • Hi Guillaume



    why don't you set default property to True of btnApply in User Form designer. When user'll press the [Enter] Key it will perform the click on btnApply.



    Regards

    Mughees Siddiqui.