Re: ComboBoxText and getting the index



Because Gtk::ComboBoxText is derived from Gtk::ComboBox, I think you can use the member function:

int get_active_row_number () const
���� Returns the index of the currently active item, or -1 if there's no active item.



Harm Hamberg


Sean Kelley schreef:
Hi,

I am porting my Qt application to Gtkmm in order to learn more about Gtkmm.� I am not particularly clear on how to get an index into my ComboBoxText.� So if I have a combo box of a number of text items, in my case Irish Gaelic prepositions, how do get the index on a changed signal?

��� //Child widgets:
��� Gtk::ComboBoxText��� m_pronBox;
��� Gtk::ComboBoxText��� m_prepBox;

....

� ��� //Fill the combo:
� ��� m_prepBox.append_text("ag");
� ��� m_prepBox.append_text("ar");
� ��� m_prepBox.append_text("as");
� ��� m_prepBox.append_text("chun");
�...
� ��� //Connect signal handler:
��� m_prepBox.signal_changed().connect( sigc::mem_fun(*this, &IrishPrep::on_combobox_changed) );
...

All I can get from the combo box is the text selected.� In Qt I had used a QtComboBox, where I could access the member function currentItem.� I would rather have the actual index into it and not the string.

Thanks in advance!

Sean




_______________________________________________ gtkmm-list mailing list gtkmm-list gnome org http://mail.gnome.org/mailman/listinfo/gtkmm-list


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