thanks a lot!
On Sun, 2007-10-14 at 12:57 -0400, Peter Gavin wrote:
> Hi Árpád,
> On 10/13/07, Poprádi Árpád <popradi_arpad@...> wrote:
> > I have read the gtk+ doc and the callback has there this signature:
> > void user_function (GtkTextBuffer *textbuffer,
> > GtkTextIter *location,
> > gchar *text,
> > gint len,
> > gpointer user_data)
> > Here is possible to supply object specific data through user_data.
> > But how can i do it in Gtk2hs?
> You would do it like this:
> > terminalNew :: IO Terminal
> > terminalNew = do
> > --setup callback
> > let callbackData = ...
> > let callback = do
> > -- do something with callback data
> > connectId <- onBufferInsertText textbuffer callback
> That is, use your function as a closure around the data your using.
> Or frequently (for short callbacks) people just do:
> > connectId <- onBufferInsertText textbuffer $ do
> > -- do stuff with callback data
> and skip defining the callback as a variable.