entry , help me ( beginner with GTK )
- From: Hascoet Pierrick <pierrick lia imt-mrs fr>
- To: gtk-list redhat com
- Subject: entry , help me ( beginner with GTK )
- Date: Sat, 16 Aug 1997 21:53:05 -0000 (GMT)
Hi all ,
I'm a young french student , who is begining to program with GTK , but
i have a problem with an entry , i explain :
I want to display an entry , and take the "char" which is put in this entry and
passed it as an argument for an other function .
I hope that someone will help me :)
Thanks .
Pierrick.
Note: i don't have find some information about using entry in GTK+
----
This is my source :
------------------
void
entry_4 ()
{
static GtkWidget *window = NULL;
GtkWidget *box1;
GtkWidget *box2;
GtkWidget *entry;
GtkWidget *button;
GtkWidget *separator;
gchar *host;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
(GtkSignalFunc) destroy_window,
&window);
gtk_window_set_title (GTK_WINDOW (window), "Scan");
gtk_container_border_width (GTK_CONTAINER (window), 0);
box1 = gtk_vbox_new (FALSE ,0);
gtk_container_add (GTK_CONTAINER (window),box1);
gtk_widget_show (box1);
box2 = gtk_vbox_new (FALSE ,10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
/* This is my entry */
entry = gtk_entry_new ();
host = gtk_entry_get_text (GTK_ENTRY (entry));
/* I want to put localhost as default argument */
gtk_entry_set_text (GTK_ENTRY (entry), "localhost");
gtk_box_pack_start (GTK_BOX (box2), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, TRUE, TRUE, 0);
gtk_widget_show (separator);
box2 = gtk_hbox_new (FALSE ,10);
gtk_container_border_width (GTK_CONTAINER (box2), 5);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
button = gtk_button_new_with_label ("Ok");
/* scan_host is the function where i want to put the char which is enter in the
entry */
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) scan_host,
host);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
gtk_widget_grab_default (button);
gtk_widget_show (button);
button = gtk_button_new_with_label ("Cancel");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) gtk_widget_destroy,
GTK_OBJECT (window));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_show (button);
}
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show (window);
}
--------------------------------------------------
E-Mail: Pierrick@lia.imt-mrs.fr
http://lia.imt-mrs.fr/linux/
|||||
(o o) -= Hascoet Pierrick =-
--ooO--(_)--Ooo----------------------------------
"Les contre-pouvoirs sont le moteur des societes qui veulent avancer"
-- O. Peron
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]