lookup_widget problems



Hi, i've just started using glade. I'm finding it quite easy to use
apart from a problem i'm having in a callback function.

The problem is as follows.

I created a signal handler as follows

Signal: Clicked
Handler: on_b_calendarOk_clicked
Object: w_calendar

NOTE: Without object set to w_calendar the program segfaulted at
lookup_widget.

I then wrote the code for the function as follows

void
on_b_calendarOk_clicked                (GtkButton       *button,
                                        gpointer         user_data)
{
  GtkWidget *w_calendar;

  w_calendar = lookup_widget(GTK_WIDGET (w_calendar), "w_calendar");
  gtk_widget_hide(w_calendar);
}

This worked fine, hiding the calendar window (w_calendar) when the OK
button was clicked.

I then modified the code in the function to the following

void
on_b_calendarOk_clicked                (GtkButton       *button,
                                        gpointer         user_data)
{
  GtkWidget *w_calendar;
  GtkWidget *calendar;
  
  guint Year;
  guint Month;
  guint Day;
  
  w_calendar = lookup_widget(GTK_WIDGET (w_calendar), "w_calendar");
  calendar = lookup_widget(GTK_WIDGET (w_calendar), "calendar");
  gtk_widget_hide(w_calendar);

  gtk_calendar_get_date(GTK_CALENDAR (calendar), &Year, &Month, &Day);
  g_print("Returned date %d/%d/%d\n", Day, Month, Year);
}

I have tried and tried to get this working in all ways i could think of,
but this function returns a segfault in lookup_widget when looking up
the pointer for calendar (the calendar widget)

I also need to get pointers to other widgets in other container windows
in this function.

I would appreciate any help, guidance and pointers in getting this to
work.

Thanks 

Karl




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