[Gambas-user] SUB in background

Rob sourceforge-raindog2 at ...94...
Thu Apr 10 21:18:16 CEST 2008


On Thursday 10 April 2008 15:02, Pino Zollo wrote:
> Now the other windows are not gray any more, the ProgressBar moves
> smoothly, but it is not possible yet to use the other forms, for
> instance to fill other datas or to click on some button...

Well, while each database transaction is taking place, the Gambas 
interpreter is doing only that, and waiting for the result.  If you 
want the database transactions to be truly background operations, you 
need to write a helper program to do them, shell out to the program 
with READ WRITE but not WAIT, and send the data to that program in 
the background (which should take much less time than the entire 
database transaction is currently taking.)  You could send the data 
in the form of a SQL statement per record, which would probably be 
easiest.

You could then have the background helper program print its results 
after each record, which would trigger a Process_Read event in your 
current application so you could update whatever you have to update.

If you write it without a graphical component selected, you won't even 
have an extra window popping up, though you could also put the 
progress bar in the database program so you had a visual indicator of 
what was going on.  With the embedding control in Gambas, I think you 
could even have your helper program display right in the same window 
as your current program without making everything freeze up during 
its operations.

This front-end/back-end structure with two processes talking 
asynchronously over a pipe is actually pretty common in the Linux 
world, and if you learn how to do it, it should help you a lot.  

Rob




More information about the User mailing list