Re: [gtkmm] Problem in CustomCellrenderer



Murray Cumming wrote:

Good day,

Actually, it is derivation problem for custom combobox that used for
editing cell value.

I used cellrenderercustom example to implement my program where user
should edit value in TreeView as combobox, entry or spinbutton. Also I
created interface class that allow me similar access to all those 3
fields using one CustomCellrenderer class. See derivation for my combobox:

class PopupEntry : public Gtk::EventBox, public Gtk::CellEditable

This is multiple inheritance of base classes that share a common base
class. So you probably need to use virtual inheritance. So you need to
_learn_ about virtual inheritance if that's what you really want. It's the
most difficult and problematic part of C++ (or any language that has
virtual inheritance, I think).

However, I have no idea why you want to inherit from Gtk::EventBox as well
as Gtk::CellEditable. It would be best to avoid this.

Well, like I said I've used cellrenderercustom example.

I guess, you know that Gtk::Entry has similar declaration:

class Entry
: public Widget,
 public Editable,
 public CellEditable
{...}

And Gtk::CellEditable is "interface" that allow to use entry when editing cell value (signals editing_done, remove_widget, etc) . Also I need Gtk::EventBox to handle events and pack other widgets into it (actually, it may be any container widget).
Yes, I know about virtual inheritance, and gtkmm using it:

class Glib::Object : virtual public Glib::ObjectBase /* inherited in Gtk::EventBox */
{...}
class Glib::Interface : virtual public Glib::ObjectBase /* inherited in Gtk::CellEditable */
{...}

Now, when I've read the comments in objectbase.h file I've solved the problem - I have to call Glib::ObjectBase (typeid(MyClass)) in last derived class in my inheritance tree, then everything go well.

Murray, thank you for the hint that remind me where to start looking for problem :).

Regards,
-andrew





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