(Friendly bump) Could anybody please tell me what i am doing wrong when i dynamically change the contents of a fixed combobox? The way i do it, every time the entries are new created, the combobox displays each entry with "echos" - instead of showing the line "a1" it shows the line "a1 a1". After the next time the contents are created, each line shows s double echo (e.g., "s1 s1 s1" instead of "s1") But when i read the contents of a selected entry, the value is correct: it yields "a1" instead of the displayed "a1 a1 a1". The attached zip file contains the sources and a makefile for a very simplified application which shows the bad behaviour. I would be very thankful for any helpful ideas Thank You Jody On Wed, Apr 1, 2009 at 1:39 PM, jody <jody xha gmail com> wrote: > 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