[maemo-developers] Gtkmm's DrawingArea problem

From: Murray Cumming murrayc at murrayc.com
Date: Sat May 31 11:03:01 EEST 2008
On Fri, 2008-05-30 at 14:19 +0800, Dinh Khac Thanh wrote:
> Hi all,
> 
> I wrote a simple program using gtkmm's DrawingArea widget. It turns
> out fine (no error) but does not show up in Xephys window. After
> searching Google I got this:
[snip]
> > > Yes, the version of gtkmm that is in the maemo repository uses some
> 
> > > special optimizations. The most obvious change is that there are no
> > > default signal handlers, so you must connect a signal handler instead of
> > > just overriding the default one.
> which I think is my problem (I check on_expose_event and it is not
> called). But I couldn't find the solution from that link.
> Could anyone tell me how to solve this? Thnx in advance.

You just need to add this code in your constructor:

#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
//Connect the signal handler if it isn't already a virtual method
override:
signal_expose_event().connect(sigc::mem_fun(*this,
&Clock::on_expose_event), false);
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

I am adding that to the clock example in the gtkmm book (in the
gtkmm-documentation module):
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-drawing-clock-example.html

> Btw, anyone has experiences on using Gnome Canvas in maemo? I am
> thinking of switching to Gnome Canvas since using Drawing Area/Gdk's
> Pixmap is a pain to me.

I recommend that you use goocanvas. libgnomecanvas is not really
maintained now, and people generally avoid using it. goocanvamm exists,
though I haven't yet used it on Maemo.


Do try to use the gtkmm-list mailing list for questions about gtkmm. You
were lucky that I saw your message on maemo-developers.

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


More information about the maemo-developers mailing list