RE: [gtkmm] Article about Gtkmm



> From: Roger Leigh [mailto:roger whinlatter uklinux net] 
> Hello again,
> 
> I've written a short article about my experiences with Gtkmm, which is
> a basic GTK+ tutorial which compares plain GTK+ programming with Gtkmm
> (and libglade is also discussed).
> 
> I don't want to misrepresent what Gtkmm/Glademm can do, so I would be
> very appreciative of anyone who could point out any inaccuracies in
> the article WRT Gtkmm.
> 
> It's available from
> <URL:http://www.whinlatter.uklinux.net/gtk/ogcalc-1.0.0.tar.bz2>.
> (GPL licensed.)

Minor points:

- "SigC++" is called libsigc++.

- There are _no_ "pros" to hand-positioned widgets/forms. Automatic
positioning does what the coder tries to do manually with fixed positioning,
and does it better. It is best to not mention GtkFixed at all, and just
stress that modern toolkits use automatic positioning. Remind them about
- hours spent laying out forms,
- windows that are too big for the screen,
- windows that are too small for their forms,
- too much or too little white space to accommodate translations
if you need to convince them.
I would mention Glade and libglade(mm) here, and encourage people to play
with it. I would not write a beginner's GTK+ or gtkmm tutorial today that
did not use libglade(mm). Hmm, you do that later - well I would say that it
gets better later.

- "Each event causes a signal to be emitted from the widget handling the
event.": A widget emits a signal - there does not need to be an additional
"event" concept, and it will just confuse people who are used to the terms
"message" or "event" where we use "signal". You might talk about signals
being emitted "as a result of user actions", but I don't see a need to
mention the "windowing system".

- Libraries: I see no need to list the individual glib and gtk+ libraries
such as gobject and gdk-pixbuf. It makes it look like there are lots of
dependencies.

- "ogcalc.glade is shared with the C++ program in the next section, which
requires it to be hidden."
This should probably say "hidden initially". As it is, it is reminiscient of
the strange need for different types of MSVC++ and Visual Basic resources to
be marked hidden or invisible in certain situations, which are familiar to
Windows coders. Those are bugs, but this is not.

- "The ogcalc class is derived from the Gtk::Window class. This class
contains
methods called calculate() and reset()." This suggests that Gtk::Window has
those methods. It does not.

- People have difficult with the idea of signals and signal handlers. I find
that it is much easier for people o understand if you use signal handlers
with names such as on_button_calculate(), rather than calculate().

- In your set_title() call, you seem to have some strange characters. Text
in source code should be ASCII.

- Your "reset_button -> signal_clicked (). connect ( SigC :: slot (*
pg_entry , & Gtk :: Widget :: grab_focus ) );" calls are rather strange, and
probably bad, and certainly not necessary in an example. Personally, I
always prefer to do these strange things inside my own signal handlers
anyway, instead of turning a standard gtkmm method into a signal handler
directly. See also "activate_default". At the least, you should comment
them.

- ogcalc :: calculate ():
Variable declarations at the top of a function are not necessary in C++.
Unitialized variables are scary.

- A major advantage of gtkmm over GTK+, is code _organisation_, not just
some idea of "security", because inheritance allows encapsualtion.

- "Further Reading"
No, the gtkmm documentation is not really available from www.gkt.org. Please
add a link to www.gtkmm.org, or http://www.gtkmm.org/gtkmm2/docs/ if you
want to go straight to the documentation.

Murray Cumming
murrayc usa net
www.murrayc.com 





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