Re: Bug in Adjustment?




Linus Gasser <urba2544@urbanet.ch> writes:

> Hello,
> I just saw a bizarre thing in gtk 1.1.1. It's when I try to redraw a
> range-widget. It changes the value on the top of the range-widget, but the
> 'button' itself doesn't move a single whee-bit. I just added a
> little code to demonstrate this. Take care, I'm a newbi, and don't look at the
> ugliness of the code ;-)
> 
> 
> ---------------------------  bug.c  ----------------------------
> 
> 
> #include <gtk/gtk.h>
> 
> 
>   GtkWidget *window;
>   GtkObject *adjustment;
> 
> void IncAdjust()
> {
>     GtkAdjustment *Adj;
> 
>   Adj = GTK_ADJUSTMENT(adjustment);
>   Adj->value++;
>   gtk_widget_draw_children(window);
> }
 
> Any ideas/suggestions???

gtk_draw_children() is an old deprecated function that does nothing
useful. And simply redrawing things isn't going to make things react
properly to an adjustment being changed.

The right way to update an adjustment is:

   Adj->value++;
   gtk_adjustment_changed (Adj);

Regards,
                                        Owen



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