Hi
I have an application which changes the contents of a combobox dynamically
whenever one of two buttons is pressed.
After the first time a button is pressed, the entries are as expected,
e.g. "s1","s2","s3"
After the second time a button is pressed, each entry consists of two
copies of the intended content, e.g. "a1 a1", "a2 a2" "a3 a3"
After the third time a button is pressed, each entry consists of three
copies of the intended content, e.g. "a1 a1" a1, "a2 a2 a2" "a3 a3 a3"
and so on.
I fill the combobox as follows:
void dyncombo::sheep_action() {
// remove previous entries
m_refTreeModelIndividuals->clear();
// fill combobox with entries from array sheep
for (int i = 0; i < sizeof(aSheep)/sizeof(char *); i++) {
Gtk::TreeModel::Row row = *(m_refTreeModelIndividuals->append());
row[m_IndividualsColumns.m_colName] = aSheep[i];
}
m_cboIndividuals.pack_start(m_IndividualsColumns.m_colName);
m_cboIndividuals.set_active(0);
}
sheep_action is linked to the clicked-event of the button m_butSheep:
m_butSheep.signal_clicked().connect(sigc::mem_fun(*this,
&dyncombo::sheep_action) );
(The sources of a simplified example are zipped in the attachment)
Am i doing something wrong here?
Any help would be very much appreciated!
Jody
Attachment:
dyncombo_src.zip
Description: Zip archive