[Gambas-user] Freeze mouse input for a second

Emil Lenngren emil.lenngren at ...626...
Mon Feb 6 18:30:53 CET 2012


When I did a similar game, I had some boolean variable called locked or
something. In the mouse receiver event handlers, I first check if the
boolean variable is set or not. If it is set, I return immediately, if not,
I continue as normal.
You should be able to do that as well.

I should not use sleep, as that freezes the whole application. For example
it does not redraw the window if it has to.

/Emil

2012/2/6 tobias <tobiasboe1 at ...20...>

> hi,
>
> > Hi All,
> >
> > I've made a small game called Memory for my kids in Gambas 2.22.
> >
> > You click one picture and make it visible, click the other and make it
> > visible, when matching pictures, disable both pictures, when not
> > matching make invisible again after 1 sec.
> >
> > This all works perfectly (at least for me). When the kids test it they
> > click one picture and the other, then the wait of 1 sec shows them both
> > pictures for a second. So far so good.
> >
> > But what do kids do, they click another picture before the WAIT 1.0 is
> > finished and the application suddenly has 3 pictures turned instead of
> > two. And this is where trouble starts :-)
> >
> > My question: Is there a way in Gambas to freeze the mouse input?
> > So when two pictures are selected and WAIT 1.0 is run, I would like evry
> > click on the mouse to be ignored for that short period. That would solve
> > the whole issue.
> >
> > Been looking in documentation and google for quite a while now, but no
> > answer found so far. Hope one of you has an answer.
> >
> > Thanks,
> >
> > Willy
> >
> >
>
> well, i remember that it was possible to
> INC Application.Busy
> to disable actions on the form (or something) but i would tend to use
> the SLEEP instruction just as you use WAIT. WAIT according to the docs
> reenters the event loop and since you do not want events to be
> acknowledged but "freeze" the program SLEEP may match the need exactly.
>
> regards,
> tobi
>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list