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?
RxTrackBarSetPosition issue
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
This must be the application itself.However, it will jump back to the original location within one second.
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);
Ranorex Team
Hi Jenö,
Thanks for the solution. Here is my routine to simulate RxTrackBarSetPosition. FYI.
Thanks for the solution. Here is my routine to simulate RxTrackBarSetPosition. FYI.
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;
}