gtk_clist_clear bug?



Hello!

I've got a problem. If you clutch the scrollbar and move
continually, after a few (about 10) seconds you get the
following message:

Gtk-WARNING **: gtk_widget_size_allocate(): attempt to
allocate widget with width XXXXX and height 1

where XXXXX is a number that is bigger than 32000 and grows
as you move the scrollbar. If it reaches circa 65000, the
Warning messages stops and if you continue to move the
scrollbar, the whole cycle starts again.

What do you think about it?
What did I wrong?
Tom

Here is the code:

#include <gtk/gtk.h>
#include <stdio.h>

GtkWidget       *window;
GtkWidget       *clist;
GtkWidget       *scrollbar;
GtkWidget       *hbox;
GtkObject       *adjust;


void destroy (GtkWidget *widget, gpointer data)
{
        gtk_main_quit ();
}


void scrollbar_callback (GtkAdjustment *adjust, gpointer
data)
{
        gtk_clist_clear (GTK_CLIST (clist));
}


void build_GUI (void)
{

        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_signal_connect (GTK_OBJECT (window), "destroy",
                        GTK_SIGNAL_FUNC (destroy), NULL);

        hbox= gtk_hbox_new (FALSE, 0);
        gtk_container_add (GTK_CONTAINER (window), hbox);
        gtk_widget_show (hbox);

        clist= gtk_clist_new (1);
        gtk_box_pack_start (GTK_BOX (hbox), clist, TRUE,
TRUE, 0);
        gtk_widget_show (clist);

        adjust= gtk_adjustment_new ( 0, 0, 1000, 1, 10, 10);
        scrollbar= gtk_vscrollbar_new (GTK_ADJUSTMENT
(adjust));
        gtk_box_pack_start (GTK_BOX (hbox), scrollbar, TRUE,
TRUE, 0);
        gtk_signal_connect (GTK_OBJECT (adjust),
"value_changed",
                        GTK_SIGNAL_FUNC
(scrollbar_callback), NULL);
        gtk_widget_show (scrollbar);

        gtk_widget_show (window);       
}


int main (int argc, char *argv[])
{
        gtk_init (&argc, &argv);
        build_GUI ();
        gtk_main ();
        return (0);
}




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