Re: Widgets not available in Glade



On Mon, 2005-01-24 at 19:06 -0300, Ney Andr�e Mello Zunino wrote:
> 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;

A Gtk:ComboBoxText is a Gtk::ComboBox.

>  and 3) 
> get_widget_derived() requires a special constructor form,

Yes, please see the example:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch19s03.html

>  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.

This seems to be a new glade feature. Could you file a
gnomemm/libglademm bug in bugzilla please? Obviously you can work around
this for now by adding the items only in your code.

>  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?

Use the base class, in Glade, that Glade does know about. It's quite
difficult to make Glade know about extra properties of your derived
class.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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