[gtkmm] Re: Question Regarding Glade
- From: Silviu Minut <minutsil cse msu edu>
- To: gtkmm-list gnome org
- Subject: [gtkmm] Re: Question Regarding Glade
- Date: Sun, 10 Oct 2004 18:52:16 -0400
> When I try to compile it, I get an error that says the window cannot be
> created because the "on_show" function for the drawingarea is abstract.
>
> Can anyone tell me why this is happening and maybe even point me in the
> direction to correct this.
>
> I can provide more details if needed.
>
> Thanks for any and all assistance.
>
> Mike
This is what's going on:
Suppose in glade you define some window (with some widgets, such as
drawing area), say MyWindow. Then, when you save and build the project,
glade creates MyWindow_glade.hh, MyWindow_glade.cc and MyWindow.hh, and
MyWindow.cc. The *_glade.?? files contain classes that define the
interface, and they contain all the handler functions (on_xxx_xxx()) as
pure virtual functions. For instance, your "on_show()" might have a
prototype like
void on_show() = 0;
This means, that in MyWindow_glade, this function has no implementation,
but the derived classes MUST override and implement this function.
You don't touch the _glade.?? files. The classes that you work with are
those derived from the _glade.?? (in this case the files MyWindow.hh and
MyWindow.cc). It is here that you define and implement all pure virtual
functions inherited from MyWindow_glade.
Now when glade saves and builds the code, the _glade.hh files are always
overridden. By contrast, the user files, are kept intact (you may have
lots of useful work in them), and the new ones are saved as
MyWindow.hh_new, MyWindow.cc_new. Your on_show() function must have been
added as a pure virtual function in the *_glade.?? files, and as a
regular member function in the *_new files, but obviously it is not
present in your original MyWindow.?? files, which are the ones used for
compilation. Consequently, the compiler doesn't find an implementation of
on_show().
So what you need to do, is cut and paste on_show() from the
MyWindow.??_new files to the original MyWindow.??
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]