Bug with ComboBoxText.clear()



There is a major bug with the clear() method in ComboBoxText - after it is 
called, no text appears and blank lines for each entry appear in the drop 
down.  Meanwhile, is there a workaround to empty the combobox and refill it ?  
I didn't see a remove item method.  Attached is a sample program that 
illustrates the problem.

#ifndef TEST_DIALOG_H
#define TEST_DIALOG_H

#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <gtkmm/box.h>
#include <gtkmm/button.h>
#include <gtkmm/comboboxtext.h>

class TestDialog : public Gtk::Window {
public:
    TestDialog();
    virtual ~TestDialog();
protected:
    //Signal handlers:
    virtual void testButtonOnClicked();
  
    Gtk::VBox vbox;
    Gtk::Button testButton;
    Gtk::ComboBoxText testComboBox;
};
#endif

TestDialog::TestDialog() {
    set_size_request(300, 300);
    set_title("Test Dialog");
    testButton.set_label("Test");
    testButton.signal_clicked().connect(sigc::mem_fun(*this, 
        &TestDialog::testButtonOnClicked) );
    vbox.pack_start(testButton, Gtk::PACK_SHRINK);
    testComboBox.append_text("combotext1");
    testComboBox.append_text("combotext2");
    vbox.pack_start(testComboBox, Gtk::PACK_SHRINK);
    add(vbox);
    show_all_children();
}
TestDialog::~TestDialog() { }
void TestDialog::testButtonOnClicked() {
    //testComboBox.clear();
    testComboBox.append_text("combotext3");
    testComboBox.append_text("combotext4");
    testComboBox.set_active(0);
}
//------------ main ---------------------------------
int main(int argc, char *argv[]) {
 Gtk::Main kit(argc, argv);
    TestDialog test;
    Gtk::Main::run(test);
    return 0;
}




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