Forum Discussion

Morgan's avatar
Morgan
Frequent Contributor
13 years ago

Selecting combo box item

I'm trying to use the wItemList property to access a specific dropdown item but am not having a lot of luck.  There's something that this novice is missing.  :)  When I run the script, the message that posts to the blog is blank.  I was using the directions listed here : http://support.smartbear.com/viewarticle/32563/



Where should I specify the item that I want to click by name? 



Thanks! 

Morgan



----



procedure SelectClass;  

var p,frmRREWiz, item, cboRREInsClassOpts, RREInsClass, del: OleVariant;

var i: integer;

begin

  p := Sys.Process(Name);

  frmRREWiz := p.VCLObject('frmRRETemplate');

  frmRREWiz.Activate;

  Delay(STD_wait);

 

  cboRREInsClassOpts := p.Window('TJvPopupDataList', '', 1);

 

  // Obtain the list of items and the current delimiter

  RREInsClass := cboRREInsClassOpts.wItemList;

  del := cboRREInsClassOpts.wListSeparator;

  aqString.ListSeparator := del;

 

  For i := 0 to cboRREInsClassOpts.wItemCount-1 do

     item := aqString.GetListItem(RREInsClass, i);

     Log.Message(item);

  •  Answer  below to your Query: There are number ways we can implement the same...below is the optimistic solution.



    Scenario:

    1. Combobox has 5 items; 1-> Kumar ; 2-> Perla; 3->NYSE; 4->London; 5--> UK

    2. Display/show  Item 3 functionality on the screen.



    Code snippet  for above scenario:



    function ComboBoxSelectionItems(ItemSelection )

    {

     

    -----;

    var ComboBoxChild =  FindChild(Array("ObjectType","ObjectIdentifier"),Array("Combobox", "Combobox_ID"),1);



    var ItemSelection  =  "NYSE";---> User will send this value to your script.

    switch(ItemSelection)

    {

     

      case: "NYSE":

      ComboBoxChild.Keys(ItemSelection );

     break;

    -----;

    ----;

      



    }



    OR



    var ItemSelection = ComboBoxChild.wItem.Items(3); // 3--> NYSE in CB;

    Switch(ItemSelection)

    {

     case: "NYSE":

      ComboBoxChild.Keys(ItemSelection);

     break;





    }





    }