Re: updating gtk_progress_bar



Hi Jordi

> I don't see how the progress bar grows. Only I see, first an empty value and
> then the full value. What I must do to update the value of the progress bar
> and see how it grows with every record ??

The code is ok I think.

The question is how did you create your progress bar ?

There must be two constructors as in gtk+ - c

function gtk_progress_bar_new : pgtkwidget;
function gtk_progress_bar_new ( gtkadjustment padjustment) : ügtkwidget;

There should also be a function called something like

procedure gtk_progress_set_adjustment( pgtkprogress progress,
                                  pgtkadjustment adjustment );

Normally the progress bar is initialized with a range from 0..1 (REAL).
If you pass 1 (for your first read block) this means max for the bar, and
that's the reason why it's full alfter the first block.

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





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