[Glade-users] i need help withglade



This is a very simple operation, I think you might need to pick up a 
book on gtk+.  I use 'Beginning GTK+/GNOME Programming, by Peter Wright 
by Wrox press.

Some comments about the layout.  I find it is better to use horrizonal 
boxesd, vertical boxes, or tables rather than 'fixed positions',  but 
it's up to you.

As far as what I did.  I went into options part of Glade and changed.  I 
haven't been able to complie with GETTEXT, so I don't use it.  If it 
works for you, then cool.  I turned on Set Widget Names and Gnome Help 
Support (which I don't think you needed the Gnome support, but I do this 
as a matter of habit.)

Then I clicked on the button1 widget.  On the glade 'Properties' window, 
I clicked on 'Signals'.  You will see an entrybox with the word 'signal' 
on the left and a button with '...' on the right.  I clicked on the 
'...' button.  I clicked the 'clicked' listing.  under 'Object' I put in 
the desination box 'list1'.  Then hit 'add'.


save & build

Then I went into the 'callbacks.c file in the /src/ directory.


Within that file you will see the callback, which I drop the code into.



    GtkWidget * listitem;
    gchar str[50];
    gchar * p_str = str;
    GtkWidget * entry = lookup_widget(GTK_WIDGET(button), "entry1");
    GtkWidget * list = lookup_widget(GTK_WIDGET(button), "list1");

    strncpy(p_str,gtk_entry_get_text(GTK_ENTRY(entry)),50);

    listitem = gtk_list_item_new_with_label (p_str);
    gtk_container_add (GTK_CONTAINER (list),listitem);
    gtk_widget_show(listitem);


Nothing hard, but you just have to go through it a few times.  The GTK+ 
coding you will have to learn independent of Glade.  Maybe join the GTK+ 
mailing list, pick up a book, or drop on the GTK+ refence web page   
http://developer.gnome.org/doc/API/gtk/index.html

-Jeff


ahmed sbaa wrote:

thank you for your sympathie...
attached to this mail you will find files generated by 
glade....
i have a text , button and a list..
i want to do that :
if i click the button the text will be insered in the list 
as an item....
please can you show me (adding C code) how to do that ...
thank you again for your help...
ahmed










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