Forum Discussion

tanusaraswat_19's avatar
tanusaraswat_19
Occasional Contributor
13 years ago

Can't perform action On objecttype "VCLObject" wndclass "TcxCustomLookupDBGrid"

Hi ,



Iam having a window application(Borland C++ builder 6). Iam not able to select a particular value from a dropdown. The dropdown appears like 

 "Sys.Process("Orchestra").VCLObject("MainProject").VCLObject("pcPage").VCLObject("TabProject").VCLObject("pcProject").VCLObject("tabGeneral").VCLObject("Panel20").VCLObject("cxDBLookupComboBoxLeadConsultant")". We are unable to perform ClickItem on this object.



Also, after clicking on the above object the dropdown opens up and show another object which  is like "Sys.Process("Orchestra").Window("TcxComboBoxPopupWindow", "", 1).Window("TcxCustomLookupDBGrid", "", 1)". Iam not able to perform any action on this particular object too.



So, Please tell me how to handle these kind of scenarios. The objective is too select a particular value from the object. Also, when we record the script is like "

Sub Test2

  Dim orchestra

  Set orchestra = Aliases.Orchestra

  Call orchestra.LeadsAssignmentsPageAddLeadLeadConsltntDropDown.Click(207, 10)

  Call orchestra.PopupWindowMrMsPeopleQuickFullDataEntry.MrMsListBoxPeopleQuickDataEntry.Click(184, 28)

End Sub
"



and replay is also not working in the case when we have multiple dropdowns on one window.



What happens is that the script works click command on the coordinates basis on the dropdown object ,after that the dropdown opens up and then it performs click on the grid object and after that it clicks on the second dropdown object and now the second dropdown is also open but click on the grid object gets stuck. The error appears like :



The window with the handle 0x000e0a00 does not exist.

Most likely, this error
occurred because the tested object (window or control) or its parent object was
deleted or recreated during the method call or before it. For instance, the
window could be destroyed or recreated after you stored the object reference to
a variable and before you called the object method through this variable.

If
the object is recreated, then to avoid the error, check the object's Exists
property before calling the method, and if the object does not exist, obtain a
reference to the new object.



Tested
object:

Aliases.Orchestra.PopupWindowMrMsPeopleQuickFullDataEntry.MrMsListBoxPeopleQuickDataEntry

(Sys.Process("Orchestra").Window("TcxComboBoxPopupWindow",
"", 1).Window("TcxCustomLookupDBGrid", "", 1))




The options coming in dropdown are also not coming when we see the properties of both the objects using "Object Spy."

2 Replies

  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)

    Tanu,


    As far as I can see, the control you are working with is TcxDBLookupComboBox by Developer Express. This is not a combo box, it's a different kind of control. Currently, it is not supported by TestComplete.


    To simulate a click, you can use internal methods and properties of this object:

    * Compile your C++Builder application as Open Application. This will make internal methods and properties of the application's objects accessible to TestComplete. For detailed instructions, see Open Applications in C++Builder.

    * After your application becomes "Open", you can use the following code to select items from your DBLookup combo box (LookupKeyToItemIndex and ItemIndex are internal method and property of the control):




    Sub Test1

      ' Obtain the control

      Set DBLookupControl = Aliases.MyApplication1.Form1.cxDBLookupComboBox1

     

      ' Obtain the index of the desired item in the drop-down list

      ItemIdx = DBLookupControl.LookupKeyToItemIndex("FRANK")

     

      ' Select the item

      DBLookupControl.ItemIndex = ItemIdx

    End Sub


    I didn't work with DB Lookup controls much, so perhaps there is a better method or property for item selection. I'd suggest that you ask your developers or ask on Developer Express forums about this.

  • Hi All..



    I am not sure if you already know the below solution, but thought of posting this since I am not able to search the following method in this forum.



    Dont know how far the following code will help you, but i am sure, this will give you an outline how i managed to select an item from a DBGrid (whose object props/methods are not accessible).



    'TestComplete Version 8.20.538.7

    .....

    .....

      set rect = YourAppName.TcxComboBoxPopupWindow.TcxCustomLookupDBGrid.Picture

      set OCRObj = OCR.CreateObject(rect)

      set OCROptions=OCRObj.CreateOptions

      OCROptions.ActiveRecognitionSet=2 '2 will recognize chars as upper case A-Z

      a=OCRObj.GetText

      b=OCRObj.FindRectByText("REQUIRED MENU", OCROptions) 'If not recognized, by default TC throws error here and stops execution

      x=OCRObj.FoundX

      y=OCRObj.FoundY

      Call YourAppName.TcxComboBoxPopupWindow.TcxCustomLookupDBGrid.Click(x,y)



    Limitations:

    1. I am using OCR method. There is one limitation using this method. Os in "TOOLS" can be detected as zeroes ("T00LS"), which leads to false.



    ActiveRecognitionSet is the key here.

    (My application had only upper case A-Z chars in dropdown list, so i used ActiveRecognitionSet=2.

    I tried adding a menu "AO1" A-zero-one and the above method failed by recognizing text as "A01" A-oh-one)



    2. If the menu item which you want is already in selected mode (highlighted), then this method is failing for me. Of course, works fine when no item is selected/highlighted.



    3. To handle error, uncheck the option Current Project Properties -> Playback -> Stop on error -> uncheck this option. Then you can use On Error Resume Next and On Error GoTo 0 as required in your script.



    Please feel free to share your feedback or enhanced version of the above.



    Thanks.