Re: [gtk-list] Notebook and listbox problems.



On Tue, May 13, 1997 at 11:25:31AM +0100, Mike Arnold wrote:
[snip]
> 
> Another thing, and I haven't checked seen as though I've just knocked
> this together, is why does the "close" button simply destroy itself and
> not the window ?????? - probably a typo, but I can't see it immediately.
[snipage]
>   /* This doesn't seem to work either..... must have typed wrong  */
>   gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc)
>	               gtk_widget_destroy, GTK_OBJECT(window)); 

Replace that bit with,

gtk_signal_connect(GTK_OBJECT(button), "clicked", 
	           (GtkSignalFunc) gtk_exit, NULL);

The problem is that functions called from the signal handler have
conform to a specific prototype.  I'm not entirely sure what that
is.. but I have managed to get things working using a function like
this...

void func(GtkWidget* widget1, Whatever **widget2)

The important part is the first argument of GtkWidget*... I think
that's why your code was destroying the close button.  That argument
is used to pass the widget generating the signal (I think).  So, the
button was passed to gtk_widget_destroy.  

The second argument ends up being what you passed as the fourth
argument of gtk_signal_connect.  This is the bit I'm not sure
about... I know it's possible to send along more than one argument,
but I'm not sure how.

It's perfectly valid to ignore the first argument, but it needs to at
least be there as a placeholder.

I do know that GtkSignalFunc is typedefed to void, so the return value
is right. :)

If you look at testgtk.c, the first function in there is a good
example of a function called from a signal.

Someone please correct me, if I'm wrong.

-- 
					-Otto.



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