$Id: gtkmmtips.html,v 1.9 1999/08/12 09:06:39 christof Exp $

Some assorted Gtk-- experiences

Table of contents:

Don't do that!
Documentation
Bugs?
Missing interfaces?
Tips and Tricks
Things you need to know
Appendix: Original Quotes

Don't do that!

Documentation

 Bugs?

 Missing interfaces?

Tips and Tricks

 Things you need to know

Appendix: Original Quotes

Havoc Pennington about the push_back problem
The bug is that the copy constructor should be private. There's no way you
should be able to do this. It's *incredibly* inefficient - that's a large
object you're copying. With much hassle and Gtk changes it could maybe be
made to work but you don't want to do it. You are probably getting a
segfault because the default copy constructor is just copying all the
internal pointers from one object to the other, and then one of the
objects (thinking it's the only object using the pointer) deletes one of
the pointers. Probably when the temporary's destructor is called if
nothing else.

There's no way to write C++ without pointers, especially with Gtk
underneath. If you don't want to use them and don't care much about
efficiency, you should probably choose a higher level language like Guile,
Perl, etc.

Tero about the push_back problem Havoc about signal connection
On Mon, 2 Nov 1998, Christof Petig wrote:
>
> while compiling a really simple program with gtkmm signals (current CVS
> and older versions checked) I ran into the strange requirement to have
> insert_connection in each class connecting to signals.
>
> This can't be right!
>

Classes that use signals have to derive from Gtk_Signal_Base.

My promise for sample programs and help:
Victor T. Ng wrote:

> Is there a decent gtk-- tutorial somewhere?  I've recently downloaded both
> qt and gtk but I can't seem to find any documentation for gtk-- for those
> who have no idea (like me) what's going on.

Hi Vic,

I really feel sorry that there is AFAIK no tutorial for gtk--. Sad!!! Sad!!!
Sad!!!

It has a really good design and we use it for large projects. If you promise
to start a tutorial I would teach you everything necessary (promise).
I don't have enough time to do so and a Gtk-- plugin for glade (GUI builder)
is of higher priority to me.

So here are my first instructions:

get gtk+ and gtk-- (source code!)

compile testgtk (gtk+/gtk) and start it. Look at the nice widgets, remember
which you want to use.
do
    cd gtk--/docgen
    make docs
(should create a bunch of .html files in gtk--/docs)
browse this with your favorite browser. The function names are really self
explanatory.
Take a close look at Gtk_Widget and Gtk_Container. These methods are common to
everything.

If in doubt: have a close look inside testgtk or gtk+/examples - think about
the code and translate it to C++ (it gets shorter almost every time).

I've got a bunch of tutorial programs available - mail me. I might even send
you some of the larger projects though they need Adabas D to compile.

Have fun and some chocolate (against frustration).

Grüße
     Christof