Re: Error Cannot Convert TextView to GtkWidget

Hi Mohammad,

On Wed, 22 Sep 2010 08:50:17 +0300 you wrote:
> I am trying to play with GNote since it is based on Gtkmm.
> I typed this:
> gtk_widget_modify_base(m_editor, GTK_STATE_NORMAL, mihColor);
> Then I got this error message:
> error: cannot convert ‘Gtk::TextView*’ to ‘GtkWidget*’ for argument ‘1’ to
> ‘void gtk_widget_modify_base(GtkWidget*, GtkStateType, const GdkColor*)’
> Why is that?

Because you're not using GTKmm

> As learned in Qt if QTextEdit is inherited from QWidget then I do not have
> to convert it.
> Is it the same case with Gtkmm? I think this is one of the advantages of
> inheritance in C++.

Yes, but you're not using GTKmm. You're using the native C function
from GTK+ and therefore you don't get the C++ inheritance benefits.
Indeed it's worse than that, because you're passing a GTKmm class
pointer to a C function that expects a GTK structure pointer.

You should be writing:
   m_editor->modify_base ( GTK::STATE_NORMAL, mihColor );


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