Re: [gtk-list] gtk-- information ??



Landshark <lndshark@megsinet.net> writes:
> Does there exist a gtk-- tutorial?  I cannot for the life of me get
> signals working with it.
> 
> I don't know what format to make the member functions that get placed into
> the connect function, nor do I know what parameters to pass to the connect
> function.

The gtk-- web page has document about connect() functions. Also the
same document README.signals comes with the package.

(The signature you need to have depends on the signal declaration --
with Signal1<int,int> sig1; you need void f(int,int); or
if you're looking delete_event -signal, in gtk--gen.h it says
its of format gint delete_event(GdkEventOther*);
)

Usually you can read the gtk's documentation for a documentation with
description of the methods available. The conversion rules from
gtk's signal to gtk--'s signal are kinda simple:

1) remove first argument (always GtkObject*) -- its replaced by C++'s
   this pointer

There has been two common problems:
1) the return type -- most problems people seem to have
is that they dont have correct return type for it.
2) forget & for the pointer to member function -- if you forget 
   it, you'll get error.

    Gtk_Button b;
    connect(button.clicked, this, &fooclass::okbuttonclicked); // ok
    connect(button.clicked, this, fooclass::okbuttonclicked); // wrong

(I added common errors -section to the signals-documentation -- if you have
other ones, let me know... the modified version is in the web page. Also
if you have other ideas for improving documentation, tell me...)

--
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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