Page 1 of 1

Location starting point from right

Posted: Tue Jan 04, 2011 5:21 pm
by mats
I'm testing a Tool Button like Outlook 2007 (or before) 'Neu' with a Dropdown-Arrow. Unfortunately is this a single Push-Button. To click on the Dropdown-Arrow, I have to use an absolute Location within the Recorder.
The problem starts if the size of the Button changes, because of other Languages or similar.

Is it possible to change the starting point of Location() within the Recorder from Top/Left to Bottom/Right (negativ values don't change the direction), or change the Member CenterRight from relativ 10% Right to absolute 6Pixel?
Worst case I have to calculate the Location value within Usercode...

Re: Location starting point from right

Posted: Tue Jan 04, 2011 6:04 pm
by Ciege
With the click() method you can add Location like Location.CenterRight.
Also, if you get the elements Height and Width in code you can easily calculate any position within that element.

Re: Location starting point from right

Posted: Tue Jan 04, 2011 6:18 pm
by Support Team
mats wrote:Is it possible to change the starting point of Location() within the Recorder from Top/Left to Bottom/Right
No, sorry. The relative location is always calculated from the top left. What you can do is specify a location in the form of "0.99;0.5" (or even "1.0;0.5"), which means a location at "99% of the width and 50% of the height of the element". This should work for your button if the width of the DropDown arrow also increases if the size of the button increases.

Otherwise you can only use usercode and calculate the position yourself :?

Regards,
Alex
Ranorex Team

Re: Location starting point from right

Posted: Wed Jan 05, 2011 10:10 am
by mats
With relative location it works. But not with 99%. I have to use 98%!
I presume there is an Error within the relative to absolute conversion. 100% of 32pixel will set the location to 33, because the absolute position starts with 0. In my case with 100%, the next button to the right will be selected.
32pixel * 99% = 31.68 -> 32 not OK
150pixel * 99% = 148.5 -> 149 OK

I didn't thought about the relative location, because the button width has a big variation. According to the window width, the button is showed with Text or not. The button width changes between 32 and 150pixel. But because the DropDown arrow has a fixed size of 11pixel, 94% to 98% will work.

Re: Location starting point from right

Posted: Wed Jan 05, 2011 10:39 am
by Support Team
Great you could get it to work that way! :D
mats wrote:32pixel * 99% = 31.68 -> 32 not OK
150pixel * 99% = 148.5 -> 149 OK
You are right, a relative location of 100% is actually one pixel outside of the element; this is by design. So IMHO the calculation is correct, at some point you have to round the floating values to pixels.

Regards,
Alex
Ranorex Team