#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::DialogBox; use Tk::JComboBox; # example by grandfather of perlmonks.org # shows how to make the textvariable ref update # see other example my $main = MainWindow->new (-title => "Test JComboBox"); EditPlayers ($main); sub EditPlayers { my ($main, $sel) = @_; my @ids = qw(Fred Joe Bob); my $dlg = $main->DialogBox (-title => "Member Information", -butto +ns => ["OK", "Cancel"]); my $id = $sel || (@ids && $ids[0]) || ''; my $IDText = $dlg->add ( 'JComboBox', -mode => 'readonly', -selectcommand => [\&changeEditPlayer, \$id], -validate => 'match', -textvariable => \$id, ); $IDText->form (-left => '%0', -right => '%100', -top => '%0'); $IDText->configure (-options => \@ids); #$IDText->setSelected ($id); # dosn't work $IDText->setSelected ($sel || (@ids && $ids[0]) || ''); #works return if $dlg->Show (-global) ne 'OK'; } sub changeEditPlayer { my ($id, $widget, $index, $value, $name) = @_; return 1 if ! defined $name; print "$name\n"; }
In reply to Re: how to get selected value of jbrowseEntrycombo box
by zentara
in thread how to get selected value of jbrowseEntrycombo box
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |