Re: [gtk-list] Re: Best way to make a dialog..



All you have to do is:
	- make sure your signal prototype is right...
	  For GtkButton::clicked, use:

	  	void callback_func(GtkButton* button, gpointer user_data);

	  (For any other particular signal, you must consult
	   the docs or source code).

	- make sure you are only passing a pointer to gtk_signal_connect,
	      e.g use &entry_ptrs, instead of entry_ptrs (although you
	      should get a compiler error about that...)
          You cannot pass a structure - only a pointer to a structure.

And no, gtk_signal_connect completely doesn't care what `user_data'
contains.  In fact, it is common practice to pass integers in there
so the signal code *never* deferences user_data.

- Dave


> > A struct seems like a perfectly good thing to use to pass the pointers:
> > 
> > struct entries{
> > GtkWidget *entry1, *entry2, entry3;
> > };
> 
> Ouch.. this is completely different than what I had in mind... I was
> hoping just to pas along a data structure not a structure with widgets as
> that means I have to create them before creating the dialog.  I can see
> how this would work but it would also chew memory as I am not just storing
> the data but the widget overhead too...
> 
> > > struct entries entry_ptrs; > 
> > gtk_signal_connect(GTK_OBJECT(ok_button), "clicked",
> > GTK_SIGNAL_FUNC(callback_func), entry_ptrs);
> I tried putting my data structure here (just data not widgets) and all I
> got was crap from the variables.... (aka ascii garbage).... so doe sthis
> mean that the data area on a signal connection must be widgets???? (I
> think am either tired or on crack :P (not to mention I attached the data
> updating to the destroy event rather than a clicked event.... if I switch
> it over to a clicked event how would i kill off the window? )



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