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
TextBox Labels
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
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
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