Help regarding splitter movement

Ask general questions here.
ThN
Posts: 15
Joined: Fri Jun 15, 2012 2:12 pm

Help regarding splitter movement

Post by ThN » Fri Jun 15, 2012 2:18 pm

Hi

I am currently using Ranorex to validate or test Windows form application. I am facing a problem with Spliter container. When I record the action of changing the slpitter size. It will not be played sucessfull when the display moniter is changed. How do I perform this action of changing the spliter position. Can anyone suggest me how can I get the handle of split container (Ranorex doesnot contains type split container) or any other solution.

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

Re: Help regarding splitter movement

Post by Ciege » Fri Jun 15, 2012 4:00 pm

Can you show the code you are using?
You say it doesn't work "when the display moniter is changed". Does that mean it works on one machine but not on another?
Are you using hard coded coordinates or are you getting the relative coordinates of the object at runtime?
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...

ThN
Posts: 15
Joined: Fri Jun 15, 2012 2:12 pm

Re: Help regarding splitter movement

Post by ThN » Mon Jun 18, 2012 11:02 am

Hi Ciege,
Thanks for reply, Here is my problem
I use a laptop of moiter size 17" and a moiter of 15". I record the movement of the splitter on laptop screen and later when played in moniter screen. It wont move the splitter. It also dont work with other machine if the resolution or moniter size is differnet. If their is any other solution let me know. I have also attached the example. Here is the below code

Code: Select all

 Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'RanorexExample.Panel1' at 445;237.", repo.RanorexExample.Panel1Info, new RecordItemIndex(0));
            repo.RanorexExample.Panel1.Click("445;237");
            Delay.Milliseconds(2030);
            
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Down item 'RanorexExample.SplitContainer1' at 637;67.", repo.RanorexExample.SplitContainer1Info, new RecordItemIndex(1));
            repo.RanorexExample.SplitContainer1.MoveTo("637;67");
            Mouse.ButtonDown(System.Windows.Forms.MouseButtons.Left);
            Delay.Milliseconds(1490);
            
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Up item 'RanorexExample.Panel1' at 263;89.", repo.RanorexExample.Panel1Info, new RecordItemIndex(2));
            repo.RanorexExample.Panel1.MoveTo("263;89");
            Mouse.ButtonUp(System.Windows.Forms.MouseButtons.Left);
            Delay.Milliseconds(700);
            
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'RanorexExample.Maximieren' at 14;5.", repo.RanorexExample.MaximierenInfo, new RecordItemIndex(3));
            repo.RanorexExample.Maximieren.Click("14;5");
            Delay.Milliseconds(1600);
            
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Down item 'RanorexExample.SplitContainer1' at 637;221.", repo.RanorexExample.SplitContainer1Info, new RecordItemIndex(4));
            repo.RanorexExample.SplitContainer1.MoveTo("637;221");
            Mouse.ButtonDown(System.Windows.Forms.MouseButtons.Left);
            Delay.Milliseconds(1210);
            
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Up item 'RanorexExample.NextActiveControl' at 554;253.", repo.RanorexExample.NextActiveControlInfo, new RecordItemIndex(5));
            repo.RanorexExample.NextActiveControl.MoveTo("554;253");
            Mouse.ButtonUp(System.Windows.Forms.MouseButtons.Left);
            Delay.Milliseconds(700);
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Help regarding splitter movement

Post by Support Team » Mon Jun 18, 2012 1:27 pm

Hi,
ThN wrote: If their is any other solution let me know.
You can then specify relative coordinates that are proportional to the heihgt and width of the UI element (e.g. 0.25;0.25 will click at the upper left part of the UI element), which are resolution independent.

Regards,
Tobias
Ranorex Team

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

Re: Help regarding splitter movement

Post by Ciege » Mon Jun 18, 2012 3:57 pm

Also, you can read what the current coordinates are of the element at runtime, then use those read coordinates rather than the hard coded coordinates that you are using now...
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...

ThN
Posts: 15
Joined: Fri Jun 15, 2012 2:12 pm

Re: Help regarding splitter movement

Post by ThN » Tue Jun 19, 2012 9:32 am

Thanks support team,
proportional to the heihgt and width of the UI element works.

@ Ciege,
Thanks for the solution. It looks advance, Can you explain it with an example.

Thanks both
ThN

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

Re: Help regarding splitter movement

Post by Ciege » Tue Jun 19, 2012 4:03 pm

Use RanorexSpy to get a look at your element(s). You'll notice there are absolute coordinates for the element that is based off of its location at runtime. If you have the xpath of your element in your repository you can just set a variable to it, else look into using findsingle to get the element at runtime. You can then set variables to the coordinate properties of the element. From there you can determine where it is you need to click and drag to...

However, if the solution that support has given you then this is moot. However, it would be beneficial for you to at least try it to get a feeling for how much more powerful your automation can be with some of your own coding.
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...