Jump to content

Detecting the presence of touch anywhere on screen


Recommended Posts

Posted

Hi, I am planning to to show a random images as screen saver but upon any touch on screen I want to render a page, How can I do the detecting the touch part ?

 
Posted

The easiest way is to use the existing pushbutton widget and using the existing image rendering routine for it. You pass a pointer to a gdispImage object via the parameter of the custom rendering function. Just use gwinSetCustomDraw() to change the parameter whenever you want to change the random picture.

Then just listen to the pushbutton even that gets fired when the button gets pushed. Easy as that.

You can simply use gwinHide() and gwinShow() to control the visibility of your screen saver widget (button).

Posted

Another alternative is to setup your own listener to listen for mouse events. Your main loop would then pick up the touch events.

If you are gwin (and it sounds like you are) then Joels method above is easiest. If you are not using gwin then setting up your own listener is the appropriate way.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...