Ranorex

RxTrackBarSetPosition issue

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexCore
View previous topic :: View next topic  
Author Message
ktsai



Joined: 15 Oct 2007
Posts: 2

PostPosted: Mon Oct 15, 2007 11:56 am    Post subject: RxTrackBarSetPosition issue
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? Confused And, any solution, please?
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 256

PostPosted: Mon Oct 15, 2007 10:02 pm    Post subject:
Quote:
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: click into code to enlarge
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
Back to top
View user's profile Send private message Visit poster's website
ktsai



Joined: 15 Oct 2007
Posts: 2

PostPosted: Fri Oct 19, 2007 12:43 pm    Post subject:
Hi Jenö,

Thanks for the solution. Here is my routine to simulate RxTrackBarSetPosition. FYI. Very Happy

Code: click into code to enlarge

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;
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexCore All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum