Re: Set up callbacks for dynamically created buttons
- From: Daniel Pekelharing <legendstar gmail com>
- To: 3saul <saul_lethbridge hotmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Set up callbacks for dynamically created buttons
- Date: Sat, 22 Apr 2006 13:38:27 +0200
On Sat, 2006-04-22 at 04:10 -0700, 3saul wrote:
So how should I implement this with the changes that David pointed out?
It's not a very complex change actually, something like this:
void button_callback(GtkWidget *button, gpointer data)
{
gint i = GPOINTER_TO_INT(data);
printf("Button %d was clicked\n", i);
}
and connect to it like:
g_signal_connect(G_OBJECT(buttons[i]), "clicked", G_CALLBACK(button_callback), GINT_TO_POINTER(i))
--
Daniel Pekelharing
<legendstar gmail com>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]