Page 1 of 1

How to perform Scroll Bar operation?

Posted: Thu Aug 23, 2007 3:47 pm
by saurabh
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

Posted: Thu Aug 23, 2007 11:03 pm
by webops
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

Element Class is also not working to scroll plz see here

Posted: Fri Aug 24, 2007 7:11 am
by saurabh
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.

Posted: Fri Aug 24, 2007 8:39 pm
by webops
The scrollbar has two "line down" buttons, a visible and an unvisible one.
You have to click the visible one:

Code: Select all

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

Posted: Tue Aug 28, 2007 1:38 pm
by saurabh
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

Posted: Tue Sep 04, 2007 6:40 pm
by chall
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;
}
}
}