RxTrackBarSetPosition issue

Class library usage, coding and language questions.
ktsai
Posts: 2
Joined: Mon Oct 15, 2007 10:43 am

RxTrackBarSetPosition issue

Post by ktsai » Mon Oct 15, 2007 10:56 am

Hi,

I tried to use RxTrackBarSetPosition(). The return result is correct, (zero). And, I did see the slider jump to the correct position. However, it will jump back to the original location within one second. If I use mouse to manually change the slider, it did move and update. Does anyone have this issue before? :? And, any solution, please?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Mon Oct 15, 2007 9:02 pm

However, it will jump back to the original location within one second.
This must be the application itself.

You can try the following (simulate mouse movements):

Code: Select all

Element element = trackBar.Element.FindChild(Role.Indicator, "Position");
Mouse.MoveToElement(element);
Mouse.ButtonDown(MouseButtonType.LeftButton);
Mouse.Move(Mouse.Position.X + 10, Mouse.Position.Y);
Mouse.ButtonUp(MouseButtonType.LeftButton);
Jenö
Ranorex Team

ktsai
Posts: 2
Joined: Mon Oct 15, 2007 10:43 am

Post by ktsai » Fri Oct 19, 2007 11:43 am

Hi Jenö,

Thanks for the solution. Here is my routine to simulate RxTrackBarSetPosition. FYI. :D

Code: Select all

int MyTrackBarSetPosition(HWND hWnd, int position)
{
	int				count1, count2;
	ElementStruct	eParent, eChild;

	count1 = 10;
	do {
		count1--;
		if(!RxControlGetElement(hWnd, &eParent))
			return 1;
		if(!RxElementFindChild( &eParent, ROLE_SYSTEM_INDICATOR,
							"Position", "msctls_trackbar32",
							&eChild, MATCH_REGEXP))
			return 2;
		if(RxMouseMoveToElement(&eChild, -1, -1, 0))
			return 3;
		if(RxMouseDown(MOUSE_LEFT_BUTTON))
			return 4;
		count2=10;
		do {
			count2--;
			if(RxTrackBarSetPosition( hWnd, position))
				goto MyTrackBarSetPosition_err;
		} while( count2 && position!=RxTrackBarGetPosition( hWnd));
		if(RxMouseMoveToElement(&eChild, -1, -1, 0))
			goto MyTrackBarSetPosition_err;
		RxMouseUp(MOUSE_LEFT_BUTTON);
	} while( count1 && position!=RxTrackBarGetPosition( hWnd));
	
	return 0;

MyTrackBarSetPosition_err:
	RxMouseUp(MOUSE_LEFT_BUTTON);
	return 5;
}