Location starting point from right

Ask general questions here.
mats
Certified Professional
Certified Professional
Posts: 23
Joined: Tue May 18, 2010 12:58 pm

Location starting point from right

Post by mats » Tue Jan 04, 2011 5:21 pm

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...

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Location starting point from right

Post by Ciege » Tue Jan 04, 2011 6:04 pm

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.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Location starting point from right

Post by Support Team » Tue Jan 04, 2011 6:18 pm

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
.
Image

mats
Certified Professional
Certified Professional
Posts: 23
Joined: Tue May 18, 2010 12:58 pm

Re: Location starting point from right

Post by mats » Wed Jan 05, 2011 10:10 am

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Location starting point from right

Post by Support Team » Wed Jan 05, 2011 10:39 am

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
.
Image