in reply to Multiple Tk::JComboBox with unique values selectable
If I'm reading the docs and examples correctly, I think you should be able to do something like this (untested):
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::JComboBox; my $mw = MainWindow->new; my $lang1; my $lang2; my @choices = qw(en fr de it sp); my $drop1 = $mw->JComboBox( -textvariable => \$lang1, -choices => [@choices], -entrybackground => 'white', -background=> 'white', -disabledbackground=>'grey', -autofind => { -enable => 1 }, -selectcommand => \&changeDrop2 )->pack(); my $drop2 = $mw->JComboBox( -textvariable => \$lang2, -choices => [@choices], -entrybackground => 'white', -background=> 'white', -disabledbackground=>'grey', -autofind => { -enable => 1 }, )->pack(); MainLoop; sub changeDrop2 { my ($drop1, $selIndex, $selValue, $selName) = @_; my @restricted = grep { $_ ne $selValue } @choices; $drop2->configure(-choices => [@restricted]); $mw->update; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Multiple Tk::JComboBox with unique values selectable
by welleozean (Novice) on Jan 29, 2016 at 17:43 UTC |