FW: RE: [gtk-list] Re: Update progressbar without gtk_timeout_ad




Well, you don't actually need to force an update at all. Try this
patch.

-tony



*** spintest.c.orig     Thu Oct 28 18:16:40 1999
--- spintest.c  Thu Oct 28 18:18:06 1999
***************
*** 8,14 ****
    GtkWidget *label_da1;
    GtkWidget *spinbutton_da1;
! gint progressbar_da1(gpointer data)
  {
    gint new_val;
    gchar new_val_char[32];
--- 8,14 ----
    GtkWidget *label_da1;
    GtkWidget *spinbutton_da1;
! gint progressbar_da1(GtkWidget *widget, gpointer data)
  {
    gint new_val;
    gchar new_val_char[32];
***************
*** 21,29 ****
    sprintf(new_val_char,"%i",new_val);
    gtk_label_set_text(GTK_LABEL(label_da1),new_val_char);
-   while(gtk_events_pending())
-      gtk_main_iteration();
-
    adj=GTK_PROGRESS(data)->adjustment;
    gtk_progress_set_value(GTK_PROGRESS(data),new_val);
--- 21,26 ----
***************
*** 74,80 ****
    spinbutton_da1=gtk_spin_button_new(adj,0,0);
    gtk_signal_connect(GTK_OBJECT(adj),"value_changed",
            GTK_SIGNAL_FUNC(progressbar_da1),
!           (gpointer) spinbutton_da1);
    gtk_fixed_put(GTK_FIXED(fixed),spinbutton_da1,410,120);
    gtk_widget_show(spinbutton_da1);
--- 71,77 ----
    spinbutton_da1=gtk_spin_button_new(adj,0,0);
    gtk_signal_connect(GTK_OBJECT(adj),"value_changed",
            GTK_SIGNAL_FUNC(progressbar_da1),
!           (gpointer) pbar);
    gtk_fixed_put(GTK_FIXED(fixed),spinbutton_da1,410,120);
    gtk_widget_show(spinbutton_da1);


On 28-Oct-99 hihihi wrote:
> Owen Taylor wrote:
>> 
>> hihihi <hihihi@casema.net> writes:
>> 
>> > Is it possible to update a progressbar without using a
>> > gtk_timeout_add
>> > ??
>> > I want to update a progressbar when a spinbutton is changed.
>> 
>> FAQ question 5.11. (On www.gtk.org or in the GTK+ distribution)
> 
> It says :
> 
> while (gtk_events_pending())
>   gtk_main_iteration();
> 
> But it still does not work for me.
> 
> I have tried the 'while ...' line in several places in
> progressbar_da1(...) 
> But no luck :-))
> 
> I have made a bar-minimum prog of my program.
> See below..
> 
> Can anyone tell me where i should place the lines ??

---
E-Mail: trog@gtk.org
Ego sum ens omnipotens.

Go Bezerk! http://www.gtk.org/~trog



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