hello,
i am using perl 5.22 with tkx on Windows 10.
with tk, i succeed to bind buttonrelease-1 to a new_tk__listbox.
but with tkx i do not succeed to bind the button to a new_tkx_Scrolled("listbox".
that is to say, when i clic, Nothing happens.
if somebody can look at this problem, that would be very fine for me, thanks by qadvance.
here is my little test program.
use Tkx;
use Tkx::Scrolled;
use strict;
my $lbox;
my $mw= Tkx::widget->new(".");
$mw->g_wm_minsize(200,200);
$mw->g_wm_resizable(1,1);
$mw->g_wm_focus();
display_main();
Tkx::MainLoop;
sub clic
{
#$box_value=$sous_lbox2->get($sous_lbox2->curselection());
my $val=$lbox->curselection();
print "val=$val\n";
return if ($val eq "");
my $value=$lbox->get($lbox->curselection());
print "$value\n";
}
sub display_main
{
# $lbox=$mw->new_tk__listbox(-height=>5,-selectmode => "single");
$lbox=$mw->new_tkx_Scrolled("listbox",-scrollbars=>"se",-height=>5,-
+selectmode => "single");
$lbox->g_pack(
-anchor=>'n', -padx=>3, -pady=>3, -expand=>1, -fill=>'both');
foreach my $key ("aa","bb","cc")
{
$lbox->insert('end', "$key- ");
}
$lbox->g_bind('<ButtonRelease-1>' , sub { clic() });
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.