aplonis has asked for the wisdom of the Perl Monks concerning the following question:

Am working on something in Perl/Tk. DirTree has a -command=>\&foo feature. I need something like that for Listbox, so that I can update something else when a line in the Listbox gets selected. How might I do that, please?

Replies are listed 'Best First'.
Re: Tk listbox -command feature?
by greenFox (Vicar) on Jun 14, 2003 at 07:26 UTC
    I think you want something like-

    $listbox->bind('<ButtonRelease-1>', [ sub { do_something() } ]);

    --
    Do not seek to follow in the footsteps of the wise. Seek what they sought. -Basho

Re: Tk listbox -command feature?
by castaway (Parson) on Jun 14, 2003 at 07:42 UTC
    The Tk::Listbox doesnt appear to support this feature. So you have a choice of: Extending it yourself to add it, or: using Tk::TList, which appears to be able to do that (and can probably look like a Listbox, if it wants to..)

    C.

      Yes, thank you. TList is just the ticket.