Forum Discussion

ct_biji's avatar
ct_biji
Occasional Contributor
13 years ago

How to Accesss the controls on the GUI

Hi,

I wanted to know how to get all the controls in the form which is presently displayed ,i.e i want to list all the controls without adding them using map object

i have attached the screen shot of the GUI

Test complete recognises the controls as

NameMapping.Sys.FronTIER.algoDialog.m_controlsPanel.WinFormsObject("ExecutionStyleGroup")



Thanks,

Doyel

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    What are you trying to test?  If you're hoping to validate the screen and make sure all the controls are there, try using an Object Checkpoint on the form and include the child objects.
  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)

    Biji,


    To iterate through child objects you can use the Child method and the ChildCount property of your window (TestComplete adds the method and property to each window object). You can find an example of iteration in the ChildCount description.


    To iterate through both visual and non-visual controls, use native methods and properties of your WinForms application.

    As far as I remember, for Windows Forms objects this is the Controls property (see the MSDN Library).