Page 1 of 1

Help regarding splitter movement

Posted: Fri Jun 15, 2012 2:18 pm
by ThN
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.

Re: Help regarding splitter movement

Posted: Fri Jun 15, 2012 4:00 pm
by Ciege
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?

Re: Help regarding splitter movement

Posted: Mon Jun 18, 2012 11:02 am
by ThN
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);

Re: Help regarding splitter movement

Posted: Mon Jun 18, 2012 1:27 pm
by Support Team
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

Re: Help regarding splitter movement

Posted: Mon Jun 18, 2012 3:57 pm
by Ciege
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...

Re: Help regarding splitter movement

Posted: Tue Jun 19, 2012 9:32 am
by ThN
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

Re: Help regarding splitter movement

Posted: Tue Jun 19, 2012 4:03 pm
by Ciege
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.