Re: Listbox: doing something on selection

From: Erick Gallesio <eg_at_kaolin.unice.fr>
Date: Tue, 27 Sep 1994 21:18:45 +0000

>
> I'd like to do something with a Listbox such that, when a user makes a
> selection, a command is triggered. I think the way I'd do this in Tk
> is like this:
>
> bind .somelist <1> +{do my command here}
>
> but I don't think the Stk version of the bind command can handle the
> "+" syntax.
>
> Any ideas?

Something like

        (define (add-binding who event new)
          (let ((old (bind who event)))
            (bind who event (format #f "(begin ~S ~S)" old new))))

permits to make the job most of the time. Note that I use strings here since
I'm not sure that bindings are aways expressed as list. If this is the cas,
this could be written

        (define (add-binding who event new)
           (bind who event `(begin ,(bind who event) ,new)


Note that it would be easy to make a add-binding-before which add the new
command before the old one.




                -- Erick
Received on Tue Sep 27 1994 - 21:18:46 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST