← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #206505]: extends Screen will make it work but why...

 

Question #206505 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/206505

    Status: Open => Answered

RaiMan proposed the following answer:
The class Region currently has some quirks (caused by the upward back
connection to Jython level - known bug), that make it very difficult to
extend it normally.

But using Screen instead does not really make sense, since each Screen
object has its own Robot object.

So if you want to use classes/methods, to have your own wrapping
features, do not use extend, but use just Screen and Region objects
normally:

public class XtendRegion {
 Region region;
 XtendRegion () {
  region = new Screen();
 }
 XtendRegion (x, y, w, h) {
  region = Region.create(x,y,w,h)
 }
// ... more constructors, if needed
 public int GetHome() throws Exception{
  int i;
  for(i=0;i<3;i++){
   region.type(Key.ESC);
   region.wait(2.0);
  }
  return 0;
 }
}

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.