this is how listbox does it
sub ClassInit { my ($class,$mw) = @_; $class->SUPER::ClassInit($mw); # Standard Motif bindings: $mw->bind($class,'<1>',[sub { my $w = shift; if (Tk::Exists($w)) { $w->BeginSelect(@_); } }, Ev('index',Ev('@'))]); $mw->bind($class, '<Double-1>' => \&Tk::NoOp); $mw->bind($class,'<B1-Motion>',['Motion',Ev('index',Ev('@'))]); $mw->bind($class,'<ButtonRelease-1>','ButtonRelease_1'); ; $mw->bind($class,'<Shift-1>',['BeginExtend',Ev('index',Ev('@'))]); $mw->bind($class,'<Control-1>',['BeginToggle',Ev('index',Ev('@'))]); $mw->bind($class,'<B1-Leave>',['AutoScan',Ev('x'),Ev('y')]); $mw->bind($class,'<B1-Enter>','CancelRepeat'); $mw->bind($class,'<Up>',['UpDown',-1]); $mw->bind($class,'<Shift-Up>',['ExtendUpDown',-1]); $mw->bind($class,'<Down>',['UpDown',1]); $mw->bind($class,'<Shift-Down>',['ExtendUpDown',1]); $mw->XscrollBind($class); $mw->bind($class,'<Prior>', sub { my $w = shift; $w->yview('scroll',-1,'pages'); $w->activate('@0,0'); }); $mw->bind($class,'<Next>', sub { my $w = shift; $w->yview('scroll',1,'pages'); $w->activate('@0,0'); }); $mw->bind($class,'<Control-Prior>', ['xview', 'scroll', -1, 'pages']) +; $mw->bind($class,'<Control-Next>', ['xview', 'scroll', 1, 'pages']) +; # <Home> and <End> defined in XscrollBind $mw->bind($class,'<Control-Home>','Cntrl_Home'); ; $mw->bind($class,'<Shift-Control-Home>',['DataExtend',0]); $mw->bind($class,'<Control-End>','Cntrl_End'); ; $mw->bind($class,'<Shift-Control-End>',['DataExtend','end']); # XXX What about <<Copy>>? Already handled in Tk::Clipboard? # $class->clipboardOperations($mw,'Copy'); $mw->bind($class,'<space>',['BeginSelect',Ev('index','active')]); $mw->bind($class,'<Select>',['BeginSelect',Ev('index','active')]); $mw->bind($class,'<Control-Shift-space>',['BeginExtend',Ev('index','a +ctive')]); $mw->bind($class,'<Shift-Select>',['BeginExtend',Ev('index','active') +]); $mw->bind($class,'<Escape>','Cancel'); $mw->bind($class,'<Control-slash>','SelectAll'); $mw->bind($class,'<Control-backslash>','Cntrl_backslash'); ; # Additional Tk bindings that aren't part of the Motif look and feel: $mw->bind($class,'<2>',['scan','mark',Ev('x'),Ev('y')]); $mw->bind($class,'<B2-Motion>',['scan','dragto',Ev('x'),Ev('y')]); $mw->MouseWheelBind($class); # XXX Both needed? $mw->YMouseWheelBind($class); return $class; }

In reply to Re^2: selecting in listbox by right click mouse by Anonymous Monk
in thread selecting in listbox by right click mouse by sagibeli

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.