How to perform Scroll Bar operation?

Class library usage, coding and language questions.
saurabh
Posts: 20
Joined: Fri Jul 20, 2007 1:11 pm
Location: India
Contact:

How to perform Scroll Bar operation?

Post by saurabh » Thu Aug 23, 2007 3:47 pm

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

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Thu Aug 23, 2007 11:03 pm

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

saurabh
Posts: 20
Joined: Fri Jul 20, 2007 1:11 pm
Location: India
Contact:

Element Class is also not working to scroll plz see here

Post by saurabh » Fri Aug 24, 2007 7:11 am

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

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Fri Aug 24, 2007 8:39 pm

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

saurabh
Posts: 20
Joined: Fri Jul 20, 2007 1:11 pm
Location: India
Contact:

Post by saurabh » Tue Aug 28, 2007 1:38 pm

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

chall
Posts: 15
Joined: Mon Aug 20, 2007 4:15 pm

Post by chall » Tue Sep 04, 2007 6:40 pm

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;
}
}
}