Hello dear monks,
I am trying to use JBrowseEntry so I can have hidden tags for items in a listbox.
According to the specification of JBRowseEntry, if I insert a hashref then reading the text variable or using get should return the key corresponding to the value selected.
It doesn't seem to work this way.
Code snippet:
#!/usr/bin/perl -w
use Tk;
require Tk::JBrowseEntry;
my %color_of = (
"apple" => "red",
"orange" => "orange",
"grape" => "purple",
);
my $MW = MainWindow->new(
-title => 'Jbrowse',
-name => 'Demo',
);
my $var = "red";
my $tmp_jbe = $MW->JBrowseEntry(-textvariable=>\$var, -width=>10,
-state=>'normal',
-btntakesfocus=>0, )->pack();
$tmp_jbe->insert('end',\%color_of);
my $but = $MW->Button( -text => "Print Value",
-width => 30,
-height => 3,
-command => sub {
my $value = $tmp_jbe->get();
print "Var = $var, Get Result $value\n";
}
)->pack();
MainLoop;
Thanks
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.