Re: updating gtk_progress_bar



Jan-Marek Glogowski wrote:

> Hi Jordi
>
>
>
> Two possible solutions:
>
> 1. Create a GtkAdjustment and pass it to gtk_progress_bar_set_adjustment
>   (something like gtk_adjustment(0, 0, filesize in blocks, 1, 1))
>
> 2. Pass the right value to the progress bar
>   (gtk_progress_set_value( progress, current block / filesize in blocks )
>   so that the value is between 0 and 1.
>
> Up to you
>
> Bye
>
> Jan-Marek

The code about de progress bar is like this :

var info : stat;

    adj  : pgtkadjustment;

...

fstat (file_name, info);

...

adj := pgtkadjustment (gtk_adjustment_new (0, 1, info.size, 0, 0, 0));

progressbar := gtk_progress_bar_new_with_adjustment (adj);

...

and later the code i've sent before.

I think that the trouble is that the program loses the control of the main loop

while is reading the file and can't redraw the widget, what can i do ?

every time

--
Salutacions.

Jordi.

http://perso.wanadoo.es/jovy
mailto:jovy wanadoo es








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