Re: [gtk-list] Detecting window from button




On Tue, 20 Oct 1998, Martin Schulze wrote:
> But can I connect a button to the delete_event handler?  The argument
> list is different:
> 
> gint pipe_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
> 
> void callback_func(GtkWidget* button, GtkWidget* dialog)
> 

I just mean to be sure you handle delete_event in some way, it doesn't
have to be the same callback. You need two handlers. However, one can call
the other. You could have: 

gint delete_event_cb(GtkWidget* widget, GdkEvent* event, gpointer data)
{
 GtkWidget* button = GTK_WIDGET(data);

 gtk_signal_emit_by_name(GTK_OBJECT(button), "clicked");
}

Which results in your button callback being called.

Or you could do it the other way around, where the button emits
delete_event. Or you could have both callbacks call a third function, like
close_dialog(). There are many different ways to organize things.

Havoc





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