[Glade-users] reading from xml documents to combo boxes



ah yes you have to either put a dummy item or setup the liststore
yourself, youll find an example of that in libglade/glade/glade-gtk.c .

cheers,
           -Tristan

On Thu, Mar 13, 2008 at 3:41 PM, Atmadarshini devi dasi
<atmadarshini_dd at yahoo.com> wrote:


Note: forwarded message attached.



 ________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
now.

---------- Forwarded message ----------
From: Atmadarshini devi dasi <atmadarshini_dd at yahoo.com>
To: Tristan Van Berkom <tvb at gnome.org>
Date: Thu, 13 Mar 2008 11:39:05 -0700 (PDT)
Subject: Re: [Glade-users] reading from xml documents to combo boxes
hi

thanks for the reply. i tried what u said. it works but only in the
situation if there is items that are already present in the combo box. what
i want to do is populate the combo box with items from an xml document for
example

<addressbook>
    <contact1>
       <lastname>Grey</lastname>
       <firstname>John</firstname>
    </contact1>
    <contact2>
       <lastname>Black</lastname>
       <firstname> Mary</firstname>
    </contact2>
</addressbook>

now i want my items in the combo box to be initially empty but i want to
populate the lastnames for instance grey and black into the combobox and
when i choose grey, i want the corresponding firstname to appear in a text
entry box. how do i go about doing this? i am creating like an address book.

Is combo box the best choice or is there another widget that is better and
easier to use?

thanks

Tristan Van Berkom <tvb at gnome.org> wrote:
 On Thu, Mar 13, 2008 at 12:38 PM, Atmadarshini devi dasi
 wrote:
hi there

I am trying to implement an address book and am using glade as the tool to
design my graphical user interface. I am programming in c and saving in an
xml document.

my graphical user interfce window consists of a combo box and a few text
entry boxes.

Now what I am trying to do is to read in from my xml documents into the
combo box and text entry boxes.

When i read into my text entry box, it is a success but I am having
problems
reading into my combo box. I know that the part where i get the
information
from the xml file is working because i can read the content onto the
console
window.

I have pasted the code where i am trying to read into the combo box below.
Please tell me where I am going wrong. Thank you.

GtkWidget *vlname_entry_widget =
lookup_widget(GTK_WIDGET(view_address_window), "vlname_combo");
gtk_combo_box_set_active (GTK_COMBO_BOX(vlname_entry_widget),
address->lastname);

http://library.gnome.org/devel/gtk/stable/GtkComboBox.html#gtk-combo-box-set-active

"lastname" here should be an integer.

Cheers,
 -Tristan



in the code above, address->lastname is pointing to the lastname node in
the
xml document


GtkWidget *vfname_entry_widget =
lookup_widget(GTK_WIDGET(view_address_window), "vfname_entry");
gtk_entry_set_text(GTK_ENTRY(vfname_entry_widget), address->firstname);

this code above works fine. I can read the entry into the text entry box.

please help.

Thanks
Aakanksha


________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
now.
_______________________________________________
Glade-users maillist - Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users





 ________________________________
Never miss a thing. Make Yahoo your homepage.
_______________________________________________
 Glade-users maillist  -  Glade-users at lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/glade-users






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