Re: Signals & Callbacks - Help!!



On Wed, Jul 06, 2005 at 10:58:59PM +0200, Jean Bréfort wrote:
> That is, the first parameter of your callback is the button which was clicked, unless you use g_signal_connect_swapped.
> SQo you have two solutions, either, you change the signayure of MessageInfo:
> gboolean MessageInfo(GtkButoon* btn, std::string& msg){...}
> or you use g_signal_connect_swapped:
> g_signal_connect_swapped(GTK_OBJECT(btnCreateAccount), "clicked",
>                       GTK_SIGNAL_FUNC(MessageInfo), NULL);

Note however, GObject callbacks don't mix very logically
with C++ pass-by-reference argument style.

You can't pass a std::string variable as the last argument of
g_signal_connect() as you would in direct function call, you
have to pass a pointer, and once you do that, it doesn't
make sense to declare

  MessageInfo(std::string &msg)

instead of

  MessageInfo(std::string *msg)

Yeti


--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?



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