Problem while doing pageup operation in scroll bar

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

Problem while doing pageup operation in scroll bar

Post by saurabh » Wed Aug 29, 2007 11:25 am

i am using following code to perform scroll bar opration for page up
Ranorex::Element* buttons[] = Listview->Element->FindChildren(Role::PushButton,"Page up");
for(int k=0;k<buttons->Count;k++)
Mouse::ClickElement(buttons[k]);

But there is a problem. when the scroll bar is already up and we perform "Page up" operation, the mouse arrow goes to the left top corner of screen and click there.So what we were looking if we find out that the scrollbar is already up it should not perform the page up operation any more.

The scroll bar has Role is "Indicator" and name is "Position"
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.
I want while i am doing the page up operation and if that Scroll bar has encountered mouse should not click on that means if in mouse click scroll bar(Role:Indicator,Name:Position) has occured it should stop that mouse click operation which i am doing for pageup. I am using RanorexPro1.2 version.
I was also trying with status like
for(int k=0;k<Ind->Count;k++)
if (Ind[k] ->State != Ranorex::State::Invisible)
{do not perform mouse click oprastion}
but its also not working.Please provide me proper code to do that.Its very argent
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 30, 2007 12:36 am

but we are again not able to find out if the indicator is already up
You can read the value of the Scrollbar as a string with the property Value:

Code: Select all

String value = scrollBar.Value;
Jenö
Ranorex Team

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

Post by chall » Tue Sep 04, 2007 6:38 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;
}
}
}