Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Output an object that currently has "focus" on the form
#1
Solved: 11 Years, 3 Months, 2 Weeks ago Question 
I am using a customer defined dot.net application. My “code” currently looks similar to this:

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.
Reply
#2
Solved: 11 Years, 3 Months, 2 Weeks ago
Just for Information for others, I found the solution from another forum. The solution was to use Descriptive Programming and to define the required object as having the property of "focused" as "True". I can then use GetROProperty("value") to output the current value of the field that has focus.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SendKeys changing focus to IE url when executed from framework psova 0 2,120 06-09-2015, 07:19 PM
Last Post: psova
  WebElement disappears on change of focus EGBELL 0 2,250 01-05-2015, 08:09 PM
Last Post: EGBELL
  Not able to do any operation on upper applet when focus is on lower applet. sonqtp 0 1,845 06-18-2012, 02:23 PM
Last Post: sonqtp
  Showing QC test lab tree folder structure in a form using OTA object guin.anirban 0 3,103 06-03-2012, 12:09 PM
Last Post: guin.anirban
  Is it possible to set focus to a particular cell in the datatable? mailashy78 4 6,373 11-18-2009, 10:48 AM
Last Post: v_selvam

Forum Jump:


Users browsing this thread: 1 Guest(s)