Re: [gtk-list] Don't know why this does not work.



On Sun, Jan 09, 2000 at 07:18:44PM +1100, Bill Shui wrote:

> void hello(GtkWidget *widget, GdkEvent *event, gpointer data)
> {
>   ...
> }
> void crap(GtkWidget *widget, GdkEvent *event, gpointer data)
> {
> ...
> }
>
> I get something like these printed out in my terminal:
> ¸ct@\ was pressed     <--- it should print "crap button was pressed"
> 
> pct was pressed.	<-- it should print "hello button was pressed"
> 
> 

The problem here is your callbacks, they should be defined as:

void hello(GtkWidget *widget, gpointer data)
{
  ...
}

No GdkEvent pointer is passed to a "clicked" callback so with your code you
will get the char pointer in the event parameter and just junk in the data
parameter.

-- 
Fredrik Hallenberg                             hallon@lysator.liu.se
http://www.lysator.liu.se/~hallon              hallon@debian.org



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