GtkEntry...



Hi, I have this struct:
struct _contain
{ GtkWidget *hostname;
  GtkWidget *port;
  GtkWidget *database;
  GtkWidget *logfile;
};

where every GtkWidget are "Entry" create via glade in this way:

contain.hostname = gtk_entry_new ();
  //gtk_object_set_data (GTK_OBJECT (window3), "contain.hostname",contain.hostname);
  gtk_widget_show (contain.hostname);
  gtk_table_attach (GTK_TABLE (table3), contain.hostname, 1, 2, 2, 3,
                    (GtkAttachOptions) GTK_EXPAND | GTK_FILL,
		(GtkAttachOptions)GTK_EXPAND | GTK_FILL, 0, 0);

[contain is defined in this way:
struct _contain contain;
in the main window function]

now, in the main window I have a Button call "ok" and I want to associate
the "pressed" event with a my function ("on_ok_pressed") and I want to
pass "contain" variable. I (with glade) have write this code:

gtk_signal_connect(GTK_OBJECT (ok), "pressed",
                            GTK_SIGNAL_FUNC (on_ok_pressed),
                            (struct _contain*)&contain);

[I have try 
gtk_signal_connect(GTK_OBJECT (ok), "pressed",
                            GTK_SIGNAL_FUNC (on_ok_pressed),
			    contain);
and
gtk_signal_connect(GTK_OBJECT (ok), "pressed",
                            GTK_SIGNAL_FUNC (on_ok_pressed),
                            *contain)
too]

This is on_ok_pressed function:
void
on_ok_pressed                          (GtkButton       *button,
                                        struct _contain contain)
{ 
 printf("%s",gtk_entry_get_text(GTK_ENTRY((GtkWidget *)contain.port)));
}

but it does not work...
any help ?

ciaoz

Ho sentito urla di sudore... che schifo...
--
Michel <ZioBudda> Morelli		  michel@michel.enter.it
					http://ziobudda.enter.it
Problemi con Linux ?    mailto:linux@saturn.media.dsi.unimi.it



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