← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #269185]: OnAppear and OnVanish on the same region

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Yep, there is a feature, which is not yet in the docs.

Each observer onXXX gets a unique name, that is registered at time of
creation. With this name one can later access this observer.

obsAppear = region.onAppear(...)

obsAppear now contains the name of this specific observer

obsVanish = region.onVanish(...)

same here

now you can say in the handler:
event.region.setInactive(obsAppear)

and
event.region.setActive(obsAppear)

setActive() returns the observer to the same state as if it had run the
first time.

Try it out, I did not fully test it yet.

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