Widgets not available in Glade



Hello.

Since 1) my application's UI is all built with Glade; 2) I would like to use a Gtk::ComboBoxText element which is not available in Glade; and 3) get_widget_derived() requires a special constructor form, I thought that the way to go would be to derive from Gtk::ComboBoxText, like the following code snippet:

class MyComboBoxText : public Gtk::ComboBoxText
{
    public:
        MyComboBoxText(BaseObjectType* cobject,
                       const Glib::RefPtr<Gnome::Glade::Xml>& refGlade)
        : Gtk::ComboBoxText(cobject)
        {
        }
        virtual ~MyComboBoxText() {}
};

The first thing I noticed was that the elements entered in Glade would not show up. So I tried adding them with Gtk::ComboBoxText::append_text(). This time they do show up, but twice per line, as if in a 2 column layout. How can I make it so that my ComboBoxText derived class uses the default m_text_columns which is a protected member of the Gtk::ComboBoxText class?

As a general related question, what's the way to go in a situation like this, where the widget needed is not directly available in Glade but one wishes to have all the UI defined there as opposed to mixing libglademm calls and manual widget instantiation/definition?

Thank you for any insights,

--
Ney André de Mello Zunino




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