Re: Is this OK?



On Wednesday 31 July 2002 19:43, TP Muller wrote:
On Thursday 01 August 2002 01:08, vladimir wrote:
void kstudentnew_quit_cb (GtkWidget *widget, gpointer callback_data)
{
    gtk_widget_destroy ((GtkWidget *)callback_data);/* destroy main
    window */
}

Can I cast callback_data like this? Main window is not main for app, but
for entry dialog for some data. When user cancel this window it calls
this callback. Is there cleaner way, or can go with this one?

You can do it like this, although it would probably be better to use the
predefined macros, which also have the advantage that they check whether
the pointer cast really points to a structure of the appropriate type
(which is invaluable when you try to find a bug where the pointer contains
bogus data).

=> GTK_WIDGET(callback_data)

Cheers
-Tim

the question that pops into my mind is - are you really done with the widget? 
if not, you will probably have to recreate it if the user wants to enter more 
data. if you use gtk_widget_hide(...) instead, you can always do 
gtk_widget_show(...) to enter more data.
Jeffrey

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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