[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [OT?] libglade, guile-gtk and glade-xml-signal-autoconnect
From: |
Bill Gribble |
Subject: |
Re: [OT?] libglade, guile-gtk and glade-xml-signal-autoconnect |
Date: |
30 Jan 2002 10:31:41 -0600 |
On Wed, 2002-01-30 at 08:58, Brett Viren wrote:
> But, maybe you mean that the (glade-xml-signal-autoconnect ...) simply
> doesn't look through "scheme space" for symbols (which is what I
> feared).
That's what I'm saying. glade-xml-signal-autoconnect is just a wrapper
that calls glade_xml_signal_autoconnect, which means that only C
function bindings are looked for.
> >
> > (gtk-signal-connect
> > widget "clicked"
> > (lambda ()
> > (simple-format #t "widget ~A was clicked.\n" widget)))
> >
> > I find the current behavior convenient, because I like using anonymous
> > functions as signal handlers.
>
> Yes, I agree. Many handlers don't/shouldn't care about what widget
> triggered them.
That's not really what I meant. The example is intended to demonstrate
that most handlers *do* want to know what widget triggered them, and
that the current guile-gtk bindings supports this nicely within the
idiom of anonymous functions as callbacks.
>
> > What would happen if you used a generic Scheme function-caller as the
> > signal handler, and put a literal C string with quotes in the "data"
> > field? the string could be the Scheme function name. This might not
> > work at all, I'm just thinking out loud.
>
> Or how about defining the callbacks in a scope that can see the
> widgets they need. Ie:
Sure, that's fine. But you can't really do the lookup from a string to
a procedure unless the lookup function itself is in the same lexical
scope as the procedure. that generally means that if you are depending
on a global function to do the callback autoconnect, the callbacks have
to be top-level functions, which makes it harder to do that kind of
trick.
b.g.