Page 1 of 1
TextBox Labels
Posted: Tue Feb 17, 2009 8:49 pm
by atom
Hiya
I have a Win32 form, that has some Textbox's on it
Each textbox has a Label next to it
How can i identify the TextBox from the label next to it ?
Thanks
Posted: Wed Feb 18, 2009 10:46 am
by Support Team
In Win32 forms these controls usually have no direct relationship. So there is no out-of-the-box method to do it.
If the layout looks like this ..
[Label1] [Textbox1]
[Label2] [Textbox2]
..
..
.. try the following:
Collect the Labels (in native win32 those are text[@class='Static']) and the Textboxes (text[@class='Edit']) in two separate lists
and compare those pairwise by geometry
so if L is the label rectangle and T the textbox rectangle
then check pairwise for
L.Right<T.Left and (L.Top+L.Bottom)/2 is >T.Top and <T.Bottom
That should do the trick.
Michael
Ranorex Team