Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to chek focus..Need Help...
#1
Solved: 10 Years, 8 Months, 4 Weeks ago
Well i am going to ask to all abt a very simple problem which i do not know...I have a text box and i have to check whether the focus is in that edit box or not....


Can any one gv me any idea that how can i check this scenario??? NOTE:: The focus is coming as pre filled on that field....So i can not set it before i check it......



Is there any method that i can Use????Need idea on URGENT basis plzzz....


Any idea or suggestion will xtreamly appreciated.....


------------
Thanx.
Reply
#2
Solved: 10 Years, 8 Months, 4 Weeks ago
Why focus is required for that?
Code:
txt=Browser().page().webedit().getROproperty("value")
if len(txt)<>0 then
msgbox 'something is already present'
else Browser().page().webedit().set "new value"
end if
Reply
#3
Solved: 10 Years, 8 Months, 4 Weeks ago
@@--rajpes ::

Thanx a lot for your precious suggestion, but i think u did not undrstnd my requirement....i just need to check whether there is any focus on that particular text box or not....

U hv send me d code of to check the length of value present in text box, n if it is zero then set something....that is not required boss....i dnt have to set any thing....just hv to check d focus is there or not....


By d way i hav find out d solution by doing trial n error method for it to check whether focus is there on any particular text field or not....


Thanx once again.....
Reply
#4
Solved: 10 Years, 8 Months, 4 Weeks ago
Ok please share what solution you have found.how do you check focus on an object
Reply
#5
Solved: 10 Years, 8 Months, 4 Weeks ago
Well, not on an object...i tried it on edit box only....I did not think it would be so simple....

tried d following...

Browser("B").Page("P").WebEdit("WE").GetROProperty("Focus")

It will return 0 or 1...if 1 then focus is present, Else not....


Hope its d permanent solution for every application....Tried it on GWT and its working fine....


Let me know if it is working for all or not.....


-----------
Thanx.
Reply
#6
Solved: 10 Years, 8 Months, 4 Weeks ago
Thats amazing. Though spy doesnot show this property it works fine
Reply
#7
Solved: 10 Years, 8 Months, 4 Weeks ago
Ya i know spy does not show this...Actually i got it by doing trial and error method....I also did not know dat it would work as d permanent solution for me......ha ha...cheers dude......



-----------
Thanx.
Reply
#8
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi Friend i followed the same process what you explained but i am getting blank alert screen. My code is

Code:
Dialog("Login").WinEdit("Agent Name:").Set "Raja"
Dialog("Login").WinEdit("Password:").SetSecure "4f7ac2299a7997511b7dfe107a3fa7a5a10912bf"
Dialog("Login").WinButton("OK").Click

a = window("Flight Reservation").ActiveX("MaskEdBox").GetROProperty("Focus")
msgbox a

is any mistake in this?????????????? can you pls share the information.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Java Popup Focus Lost davey2582 2 5,034 01-03-2012, 07:54 PM
Last Post: davey2582
Sad How to set focus or click on the center of webpage? brar.arsh 5 11,014 05-26-2011, 02:26 PM
Last Post: souvikghosh_diatm

Forum Jump:


Users browsing this thread: 1 Guest(s)