[Gambas-user] How to interrupt a loop ?

comisat at ...1569... comisat at ...1569...
Thu Sep 28 14:14:33 CEST 2006


hi
if i've understood the question,
try this way..
-------------
private blnStop as boolean

public sub btnStopLoop_click()
blnStop=true
end sub

public sub Compute()
if blnStop=true then return

compute code

end sub
-------------
bye :)

comisat

> Hello everybody,
>
> My problem is now the following : I have a form in Gambas,
> with a button called "compute". When this button is clicked,
> the program executes "compute_click()", which is essentially
> a loop where a computation is done, which may be rather long,
> depending on some other parameters of the program.
>
> So I would like to have the possibility of interrupting this computation,
> with a click, or a keypress, or whatever. But it seems that once
> the computation loop has started, all the events I could use
> are inactive (the mouse clicks are no longer seen, nor the keys
> pressed, even the timer events), until the loop has terminated.
>
> I imagine I am missing something here. I have tried to define
> a new EVENT I could RAISE at some point in the loop, but
> I didn't succeed, and I confess I don't understand Gambas
> documentation on this subject.
>
> So the only thing I can do at the moment is stop the program by
> closing its window, and waiting for KDE to kill the application.
> Of course, this is definitely not a good solution... :-(
>
> Thanks for any suggestion.
> Serge.
>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>


_________________________________________________

 * GPG/PGP public key-id: 0xB703A9E2
 * http://comisat-games.sourceforge.net
 * rfc.altervista.org aspetta il tuo contributo
 * USE=-brain emerge win
 * "Sulla confezione c'era scritto: necessita' di
   win9x, winXP o superiore..
   ...cosi' ho installato linux"
_________________________________________________





More information about the User mailing list