gtk_widget_hide problems



Hello, everyone!

Is gtk_widget_hide supposed to mess the signals up? I have a spin button called LCBox and a "value-changed" signal connected to its adjustment. Its job is to tell the program how many lightcurves are available and, as a consequence, how many entry boxes do we want on the screen. If the value is increased, the program should add an entry box, and if it's decreased, an entry box should be deleted. So I call the following function:

void LCNoIsChanged (GtkWidget* widget, gpointer data)
  {
  gint ChangedLCNo;

  ChangedLCNo = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (LightBox));

  if ( ChangedLCNo - DisplayedLCNo == 1 )
    {
    /* This means the LC number increased */

    g_print ("LC Number increased by 1\n");
    DisplayedLCNo = ChangedLCNo;		
    }

  if ( DisplayedLCNo - ChangedLCNo == 1 )
    {
    /* This means the LC number decreased */

    /*
    gtk_widget_hide (LightLabelEntry[DisplayedLCNo]);
    gtk_widget_hide (LightTextEntry[DisplayedLCNo]);
    gtk_widget_hide (LightBrowseButton[DisplayedLCNo]);
    gtk_widget_hide (FilterLabel[DisplayedLCNo]);
    gtk_widget_hide (LightFilterBox[DisplayedLCNo]);
    */

    g_print ("LC Number decreased by 1\n");
    DisplayedLCNo = ChangedLCNo;
    }

DisplayedLCNo is a counter for displayed entry boxes, and ChangedLCNo is changed spin button number.

The problem is: if I leave remarks /*  */ around gtk_widget_hide (as in the example above), everything will work perfectly. But if I try to run the program with gtk_widget_hide-s, the spin-button value will fall from 15 to 0, thus erasing every single entry box I have.

Is this a bug or am I doing something wrong? Also, the hiding process takes a LOT of time; is there a better way to do this?

Thank you all very much!

Andrej




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