Forum Discussion

teddy77777's avatar
teddy77777
Contributor
15 years ago

How to not drop-down combobox every time data is read from it?

Every time I try to obtain wItemCount or wItem the combobox drops down, I don't see why it needs to do this every single time. I can use the object browser to get all of this data without seeing the drop down come down once.





Is there something I need to do to stop it from dropping down the list every time?  Dropping down the list every time significantly slows down the time it takes my script to complete.





Thanks

3 Replies


  • Hi Ted,





    This behavior is normal. There are combo boxes that build the entire list of items only when expanding, so to be sure that the items of your combo box are recognized, we expand a combo box (when using wItemCount and wItem from script).





    If this is annoying for you, you can use native properties to get access to items of your combo box. For example, you can use the ItemCount and Items native properties:





    // Our sample application - Orders (Delphi):

    // "C:\Users\Public\Documents\TestComplete 7 Samples\Open Apps\OrdersDemo\Delphi"

    // Run exe, select "Orders | New order..." and run the following script





    var combo = Sys.Process("Orders").VCLObject("OrderFrm").VCLObject("Product_ComboBox");

    for (var i = 0; i < combo.ItemCount; i++) {

      Log.Message(combo.Items.Strings(i));

    }

  • There has got to be a way to not do drop down these boxes every time.  It takes up valuable time and is very annoying.  I want the static data.  I don't believe our application supports the methods you suggested, because I can't figure out a way to get them to work.  Like I said previously, I can pull up the object browser get all of the necessary information and the drop down never every comes down, so why is it necessary during my script to do so.  Has a workaround I tried the example given in the Help to get the Combobox items using wItemList thinking I could use the item list data to do the checks I need to do before selecting an item, but even that resulted in the drop down coming down 3 times.












  • Hi Ted,




    I don't believe our application supports the methods you suggested



    Did you compile your application with debug info? If you didn't, please do this by using instructions from the "Open Applications in Delphi" help topic.


    If your application is compiled with debug info, please use the Object Browser to check whether your check box controls have necessary properties (see the "Object Browser Overview" help topic).