Re: fork() and progress bar...

On Fri, 2001-09-07 at 00:30, Jeff Shipman - SysProg wrote:
> I've got a situation where I need to load information
> from a MySQL db and on the screen continuously update
> a progress bar. What I'd like to do is while the
> db is fetching the information, show a little progress
> bar that just goes back and forth. When that finishes,
> change to a 1-100% Progress for each fetched item
> that is processed. Then, make the progress bar 0%
> and say that it is waiting.
I've solved this (without progress bar though, but it loads a recordset
from a database "asynchronously") in gnome-db by using a timeout
function. You can set it to a small interval (200 ms I've got myself),
and it will run as quick as if you did it hanging the rest of the
program, while you still can continue using the application.

What I do is to retrieve a row per call to the timeout function, so you
can do the same and, at the same time you fetch one row, you can update
the progress bar.

Although, it would be easier for you if you use gnome-db widgets for
your program, and you'll just have to do:

recset = gda_connection_execute (cnc, "SELECT * FROM my_table");
grid = gnome_db_grid_new (recset);

and gnome-db will do the async loading for you :-)

Rodrigo Moya <rodrigo gnome-db org> - <rodrigo ximian com> -

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]