how to set gtk2 combo box entry place

S

shawn bright

OK,
i am using ruby-gnome2 to develop a gui app.
I have a combobox that i create with Gtk.ComboBox.new
this is so i can populate it with append_text() and prepend_text()

my question is, i need to be able to set it to a certain value.
like if I have a list of items that i have used to append text to this combo,
apple, 0
orange, 1
pear, 2
grapes, 3

and another function selects say grapes, how do i set the combobox to
show that selection automatically ?

does this make sense?

thanks for any help,
sk
 
J

Jonathan Hudson

OK,
i am using ruby-gnome2 to develop a gui app.
I have a combobox that i create with Gtk.ComboBox.new
this is so i can populate it with append_text() and prepend_text()

my question is, i need to be able to set it to a certain value.
like if I have a list of items that i have used to append text to this combo,
apple, 0
orange, 1
pear, 2
grapes, 3

and another function selects say grapes, how do i set the combobox to
show that selection automatically ?

widget.set_active(3)

or

widget.active=3

(assuming 3 == grapes ...)

-jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top