Forum Discussion

AKarandjeff's avatar
AKarandjeff
Contributor
14 years ago

Getting Current Object via JScript

I have a situation where I've got a combination of keyword tests and a script routine to select a particular value from a combo box.  I will click to set the focus in the JTextField within the comboBoxes, and from there let script routine cycle through the wText values of the JTextField until it finds the value it's looking for.  I need to do this in several different combo boxes, and I am struggling with how I can identify in the script where I currently am so I can set that as a variable that I can then process against in the remainder of the script.  Thanks.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Is there a reason why you are not simply using the "ClickItem" method for the combo box and passing in the text value of what you're looking for?
  • Yes, from what I have read, and the way my testing has borne out, the values for our JComboBox are not getting picked up by the ClickItem even.  It will recognize the index, but not the value, and the index can change as the combo box list is dynamic.  Hence I have to use the wText property of the JTextBox object of the combo box.  This combo box exists on several different panels, so am wanting to be able to use the same search and find routine and just feed in the current object based on where I click in the keyword test.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I'm not familiar with the JComboBox class, however, in my experience, isn't there an "Items" property or a "wItems" property for most of the combo box type items?  Rather than having to check the text, check that property and use a quick parse of the value to find the index you want.
  • OK, that makes sense.  I was able to do what you suggested, changing the Keyword test to a wText operation as opposed to a click and setting the value of the comboBox to what I wanted.  Then adding a Keys operation to tab out of the field so the value actually gets picked up by the application.  I think that will work. Thanks for your help.