RE: [gtkmm] Comments on tutorial



> comment in the declaration of CustomDrawingArea:
>
>   //TODO: Why do we store m_width and m_height?  murrayc
>
> which makes no sense in its context.  I assume this code was already
fixed,  or it was copied from somewhere where it might 
> have made sense.

Yes.

> Second,  the main method contains the unexplained line:
>
> Gtk::Main main_runner(argc, argv);

It's a very basic gtkmm technique, explaind in the "Basics" chapter:
http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch03.html#id2807900

> Looking back over previous chapters,  I see the line
>
> Gtk::Main kit(argc, argv);
>
> in the corresponding place,  which is explained in the beginning of the 
> tutorial.  I notice that the author of chapter 14 (M'Sadoquesis) is
different from the author of the previous chapters,  
> which may help 
> explain this.  Someone needs to advise the author of chapter 14 to get in
line with the previous chapters.

I don't see the problem. It's just a variable name that's different. You can
write
Gtk::Main soylentgreen(argc, argv);
if you like. It won't make any difference.

> Another thing that surprised me was that there was no interactive 
> example in the chapter,  such as a drawing application,  or at least
something that responds to a mouse click or anything.  I > think of that as
a sort of hello world for canvas type widgets.

That might be nice. You might look at the "Monster Masher" game and, after
you have learnt how, provide an extra example, or add to one of the
examples. Patches are welcome.

Note that libgnomecanvamm or foocanvasmm might be more suitable for you.

> Instead of dealing with normal interactive events like mouse events, the
example programs are all built around around 
> responding to the expose event (in on_expose_event).  Why?  On first
impression,  this strikes me as rather strange.

That's a fundamental part of using a Drawing Area, as mentioned in the first
paragraph of the chapter:
http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch14.html

Maybe it should be made even clearer though.

Murray Cumming
www.murrayc.com
murrayc usa net



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