in reply to simultaneous selections in Tk

Add the -exportselection => 0 option to all listboxes.
#need exportselection=>0 for using multiple selection boxes my $lb0 = $mw->Listbox(-selectmode => 'extended', -exportselection=> 0 )->pack;

I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^2: simultaneous selections in Tk
by momo33 (Beadle) on Nov 02, 2008 at 18:33 UTC
    This seems to work. Not the first thing I thought of.
    Thank you.
      Not the first thing I thought of

      Heh, heh....don't worry, I think every Tk user has asked that question the first time they use Listboxes..... I did too. :-) It is listed as an option in the perldoc, but dosn't say what it's for.


      I'm not really a human, but I play one on earth Remember How Lucky You Are
        It is listed as an option in the perldoc, but dosn't say what it's for.

        True, "perldoc Tk::Listbox" only mentions the "exportSelection" option with the cryptic remark "(see exportSelection option)", and you have to know that this means "go to 'perldoc Tk::options'", where you'll find (in proper alphabetical order):

        Specifies whether or not a selection in the widget should also be the X selection. The value may have any of the forms accepted by Tcl_GetBoolean, such as true, false, 0, 1, yes, or no. If the selection is exported, then selecting in the widget deselects the current X selection, selecting outside the widget deselects any widget selection, and the widget will respond to selection retrieval requests when it has a selection. The default is usually for widgets to export selections.

        Update: Even with that, the option might still be hard to understand for people who use Perl/Tk without the benefit of an X-Windows environment (i.e. on MS-Windows systems) -- I guess such users wouldn't quite know what it means until they happen to guess that it might be worthwhile to try it out.