Re: Type of widget



On Wednesday 31 March 2004 02:57, Russell Shaw wrote:

If i define a GtkWidget as: item=gtk_label_new("thing") or
item=gtk_button_new(), how can i find later whether "item"
is a label or a button?

     if (GTK_IS_BUTTON(item))
     {
          g_print("item is a button.\n");
     }

etc.

or

    g_print("item is of type '%s'\n", g_type_name(G_OBJECT_TYPE(item)));

Cheers
-Tim



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