How to use DragDrop function in java

Asked by Saorabh Singh

I am using Sikuli in JAVA

i have image of scroll bar(ScrollRight)...& endpoint..end point is not visible So i want to scroll till it gets visible.

i have tried below code..but its not working :(
Sample code:

Pattern ScrollRight = new Pattern(imagePath + "android/imgs/Right_ScrollBar.png");//Scroll bar
Pattern ScrollEnd = new Pattern(imagePath + "android/imgs/Right_ScrollEnd.png");//End point..Till here i want to scroll..Endpoint is dynamic

Region wait=s.exists(ScrollEnd,1);
count=0;
if(wait==null &&count<5)
{
        Region z=s.find(ScrollRight);
 Region k=z;
 k.x=z.x-100;
 s.dragDrop(z,k,0);
 wait=s.exists(ScrollEnd,1);
        count++;
}

Please help me out.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

have a look at Region.wheel() (mouse wheel simulation).

if this does not work, try mouseDown()/mouseMove()/mouseUp() with sufficient intermediate wait()'s if necessary.

Revision history for this message
Saorabh Singh (kunnu30) said :
#2

Some Issues:
1)
mouseMove(PSRML) is not Available ,most of other function are available
2)
in mouseUp([button])function
Req Parameters: •button – one or a combination of the button constants Button.LEFT, Button.MIDDLE, Button.RIGHT.
How to get these Parameters in Java??/

Do in need to Import some Package ???

How to Solve this Problem??

Revision history for this message
RaiMan (raimund-hocke) said :
#3

-- at 1:
you are right --- sometimes I really hate these inconsistencies between Jython and Java API.

use Region.hover() instead.

-- at 2:
same as with 1 ---- arghhhh!!!

this is from Button.py:

from java.awt.event import InputEvent
class Button:
   LEFT = InputEvent.BUTTON1_MASK
   MIDDLE = InputEvent.BUTTON2_MASK
   RIGHT = InputEvent.BUTTON3_MASK

Can you help with this problem?

Provide an answer of your own, or ask Saorabh Singh for more information if necessary.

To post a message you must log in.