| View previous topic :: View next topic |
| Author |
Message |
saurabh
Joined: 20 Jul 2007 Posts: 20 Location: India
|
Posted: Thu Aug 23, 2007 4:47 pm Post subject: How to perform Scroll Bar operation? |
|
There is no specific control giving by Ranorx Spy and I didn't find any method so that i can do scroll bar operation in my application.There is no methos in form class for scroll bar like we have for all other elements findListView(),FindTextBox() etc. So pleae provide me a sample code and tell me how to gar control(Handler) for scroll bar in a application and how to scroll that up and down _________________ Regards,
Saurabh Shrivastava
GE Global Research
Bangalore India |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Fri Aug 24, 2007 12:03 am Post subject: |
|
Sorry, we have no special scroll bar functions in V1.2, we are currently working on some extensions.
But you can solve your problem with the Element class, find the scroll bar buttons by Role and Name and push them, or read the position of the Indicator.
Jenö
Ranorex Team |
|
| Back to top |
|
 |
saurabh
Joined: 20 Jul 2007 Posts: 20 Location: India
|
Posted: Fri Aug 24, 2007 8:11 am Post subject: Element Class is also not working to scroll plz see here |
|
As you told i was trying with Element class.Through Ranorex Spy I have got Role:PushButton and Name:Line down to scroll down my ListView after that i am trying to do that by give code:
Element *pushdown=form->Element->FindChild(Ranorex::Role::PushButton,"Line down");
Mouse::ClickElement(pushdown);
This code is not working.Its always Mouse RightClick on top left corner on the current open window not even in my application. Please suggest me any way so i can do that its very critical.I am using RanorexPro1.2 which is paid version. _________________ Regards,
Saurabh Shrivastava
GE Global Research
Bangalore India |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Fri Aug 24, 2007 9:39 pm Post subject: |
|
The scrollbar has two "line down" buttons, a visible and an unvisible one.
You have to click the visible one:
Code: click into code to enlarge
// Searching and pressing the line down button
Element[] buttons = listView.Element.FindChildren(Role.PushButton, "Line down");
foreach (Element button in buttons)
{
if (button.State != State.Invisible)
Mouse.ClickElement(button);
}
Jenö
Ranorex Team |
|
| Back to top |
|
 |
saurabh
Joined: 20 Jul 2007 Posts: 20 Location: India
|
Posted: Tue Aug 28, 2007 2:38 pm Post subject: |
|
the snippet of code what you send helped a lot. and instead of "linedown" we used "Page down" and "Page up" to scroll.
But there is a problem. when the scroll bar is already up and we perform "Page up" operation, the mouse arrow goes to the invisible section and clicks. this is creating a problem and missing some of the operations it is to perform. So what we were looking was if we find out that the scrollbar is already up it should not perform the page up operation any more.
we also tried using the "Indicator" i.e the scroll bar
Ranorex::Element* Ind[] = lvCtrl->Element->FindChildren(Role::Indicator,"Position");
it is receiving all the indicator in the array. but we are again not able to find out if the indicator is already up, and the perform "page up" if required.
thanks _________________ Regards,
Saurabh Shrivastava
GE Global Research
Bangalore India |
|
| Back to top |
|
 |
chall
Joined: 20 Aug 2007 Posts: 15
|
Posted: Tue Sep 04, 2007 7:40 pm Post subject: |
|
This is what I do; it may work you:
Ranorex.Control control = form.FindControlId(scrollID);
if (control != null)
{
for (int i=1; i<=scrollCount; i++)
{
Element scrollElement = control.Element.FindChild(Role.PushButton, "Page up");
if (scrollElement != null && (!scrollElement.State.Equals(State.Invisible)))
{
Console.WriteLine("Time to start scrolling");
Mouse.ClickElement(scrollElement);
}
else
{
Console.WriteLine("Time to stop scrolling");
break;
}
}
} |
|
| Back to top |
|
 |
|