Re: duplicated entries in combobox



Additional information:

When i read the selected value in the combobox, it is correctet.
For example, after pressin the button 4 times, the first line in the
combobox reads "a1 a1 a1 a1" but when i select it and check
the value it is simply "a1".

Any ideas?

Thank You
  Jody

On Wed, Apr 1, 2009 at 12: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
>


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