in reply to Binding double click in a Perl/Tk form

What kind of widget is the $tk_form{output_list}? ListBox? HList? Tree?

Until you post what type of widget you are using, you could use the following general steps:

  1. fetch the coordinates of the mouse double-click event
  2. using the coordinates, find out which 'list' item has been clicked on
  3. get the item text, i.e. for an HList--$hlist->entrycget(-text)

Other links that may help:

--
hiseldl

  • Comment on Re: Binding double click in a Perl/Tk form

Replies are listed 'Best First'.
Re: Re: Binding double click in a Perl/Tk form
by blackadder (Hermit) on Aug 20, 2002 at 08:25 UTC
    Its a Tlist...

    $tk{output_list} = $tk{right_frame}->Scrolled('TList', -height=>'1', -width=>'1', -scrollbars=>'osoe',);

    Many thanks for your contributions...Its is your Drag and Drop example that I have originally used, sparked and started everything off (well this project at least). My whole project is based on this example.

    By the way: how can I get a further sub window to take control of the main Tk window “what I call a form” (like a dialog window but also requires user input) and the controls should remains with this sub windows until the user has responded with an input, (I can create the sub window, but I don't know exactly how to keep the control focused on it ).


    Many thanks

    Blackadder
        By the way: how can I get a further sub window to take control of the main Tk window “what I call a form” (like a dialog window but also requires user input) and the controls should remains with this sub windows until the user has responded with an input, (I can create the sub window, but I don't know exactly how to keep the control focused on it ).

      Do you mean a modal dialog? e.g. a dialog that keeps focus until the 'OK' or 'Cancel' buttons (or whatever buttons) are pressed and doesn't let the user input anything on the main window.

      Also, try binding the double click event directly to the Icon, Label or whatever instead of to the TList, this should work equally as well. Just substitute $tk_form{output_list} with your Label widget, i.e. $tk_form{label}->bind(...). Then let me know if this doesn't work so we can work it out the hard way by figuring out which element of the TList was clicked, etc.

      --
      hiseldl