08-02-2010, 08:55 PM
I am using a customer defined dot.net application. My “code” currently looks similar to this:
So it clicks a text field (which I know exists and know the naming of) and then presses the down key. I plan to put the down method in a loop so that it will keep going down till it finds an empty cell.
My problem is that the naming of the fields are not consistent. As you can see I am starting on text field 33, but the next text field could be 34 or 134 as it varies on each form. But I do know that if I press the down key it will move to the text field that I require, as the text fields are laid out in a column.
I need to know how to output to QTP what current field has “focus” – I will then use this field to see if it is “empty”, if not, I will click down to the next field and repeat the process till I find the first empty text field in the list. Like I said previously, this does not follow logical number all of the time but I do know it will have the mouse curser in the field as it will be “focused”.
Is it possible to output what object in the form currently has the focus – and if so, how would I go about writing this?
Thanks for any help in this matter.
Code:
SwfWindow(“MyProgram”).SwfWindow(“MyForm”).SwfEdit(“txtDisplayedValue_33”).Click
SwfWindow(“MyProgram”).SwfWindow(“MyForm”).SwfEdit(“txtDisplayedValue_33”).Type micDwn
So it clicks a text field (which I know exists and know the naming of) and then presses the down key. I plan to put the down method in a loop so that it will keep going down till it finds an empty cell.
My problem is that the naming of the fields are not consistent. As you can see I am starting on text field 33, but the next text field could be 34 or 134 as it varies on each form. But I do know that if I press the down key it will move to the text field that I require, as the text fields are laid out in a column.
I need to know how to output to QTP what current field has “focus” – I will then use this field to see if it is “empty”, if not, I will click down to the next field and repeat the process till I find the first empty text field in the list. Like I said previously, this does not follow logical number all of the time but I do know it will have the mouse curser in the field as it will be “focused”.
Is it possible to output what object in the form currently has the focus – and if so, how would I go about writing this?
Thanks for any help in this matter.