Re: buttons!!!



GtkButton is container. Its derived from GtkBin class. When you create button with gtk_button_new_with_label() the child of the button will be GtkLabel with your text.

void print_buttons_label(GtkButton *button)
{
GtkWidget *child;

   /* checking that parameter is of GtkButton type */
   g_return_if_fail(GTK_IS_BUTTON(button));

   /* getting the child of the button */
   child = gtk_bin_get_child(GTK_BIN(button));
   /* checking that child is of GtkLabel type */
   g_return_if_fail(GTK_IS_LABEL(child));

   /* printing out label's text */
   g_print("%s\n", gtk_label_get_text(GTK_LABEL(child)));
}

   Olexiy




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