=?UTF-8?Q?no_text_show_in_combobox=EF=BC=88glade_&_gtkmm=EF=BC=89?=



I use glade to create a combobox, and use model to show text.
but it is only show row but text


#include <gtkmm.h>
#include <libglademm.h>
#include <iostream>
class combo_model : public Gtk::TreeModel::ColumnRecord
              {
              	public:
                       combo_model(){add(m_name);}
                       Gtk::TreeModelColumn<Glib::ustring> m_name;
              };

int main(int argc,char *argv[])
{
    Gtk::Main kit(argc, argv);
    
    Glib::RefPtr<Gnome::Glade::Xml> refXml;
    Gtk::Window* p_win;
    Gtk::ComboBox* p_com;
    Glib::RefPtr<Gtk::ListStore> p_m_com;
    combo_model com_m;
    
    try{
        refXml = Gnome::Glade::Xml::create("new.glade");
    }catch(const Gnome::Glade::XmlError& ex){
                 std::cerr << ex.what() << std::endl;
                 return 1;
    }
    
    refXml -> get_widget("win", p_win);
    refXml -> get_widget("com", p_com);
    
    p_m_com=Gtk::ListStore::create(com_m);
    p_com -> set_model(p_m_com);
    
    Gtk::TreeModel::Row row = *(p_m_com -> append());
    row[com_m.m_name] = Glib::locale_to_utf8("男");
    
    
    kit.run(*p_win);
    
    return 0;
}

http://www.nabble.com/file/p20890062/combobox.jpg 



-- 
View this message in context: http://www.nabble.com/no-text-show-in-combobox%EF%BC%88glade---gtkmm%EF%BC%89-tp20890062p20890062.html
Sent from the Gtkmm mailing list archive at Nabble.com.



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