Re: [gtk-list] Detecting window from button




On Mon, 19 Oct 1998, Martin Schulze wrote:
> 
> The new dialog has a Close button.  However the signal handler doesn't
> know which window to close.  Storing one global variable for this very
> windows isn't a solution but a bad workaround.
>

Why not pass the dialog as callback data? i.e.

gtk_signal_connect(button, "clicked", callback_func, dialog);

void callback_func(GtkWidget* button, GtkWidget* dialog)
{
	gtk_widget_destroy(dialog);
}
 
> In connection to the above scenario I wonder how it would be possible
> to disable the OK button in the main dialog until the data is
> processed (and the window is closed anyway) or the error box is
> closed.
> 

You can gtk_widget_set_sensitive(button, FALSE).

You'd need to figure out some way to do all the signals; you could
possibly connect a second callback to the error dialog which re-sensitizes
the button in the main dialog. 

Don't forget delete_event on your dialogs, that can also make them close.

Havoc




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