Re: [gtk-list] Strange file selection behaviour



On 3 Jun 1999, Lars Haugseth wrote:

Hello ,

> I have a problem with the file selection dialog. When I click
> the cancel button, the dialog doesn't close, but instead the cancel
> button disappears. The code is as follows:

[...]

>     /* Register cancellation event */
>     gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(dia_file)->cancel_button),
>                        "clicked",
> 		       GTK_SIGNAL_FUNC(gtk_widget_destroy),
>                        GTK_OBJECT(dia_file));

[...]

The problem is , that first parameter of callback function is that 
widget which calls the callback and second parameter is that
registered by gtk_signal_connect as data. So when you put
gtk_widget_destroy functuion as a callback function, it allways destroy
widget which calls the callback (the cancel button). You have to write own
callback function for destroing widget given as callback data.

for example :

void KillWidget(object , data)
GtkObject *object;
gpointer data;
{
	gtk_destroy_widget(GTK_WIDGET(data));
}

Regards,
Stevo.

---
Stefan Ondrejicka <ondrej@idata.sk>
Beethovenova 11, 917 08 Trnava, Slovakia
http://www.idata.sk/~ondrej/



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