in reply to Cursor keys with Tk::Hlist goes wrong

I don't know why your bindings have messed up, but maybe you can manually fix them. Add corrections yourself. I'm hazarding a guess that you have your indices all messed up, and don't realize it. Here is a clue as to how to do it.
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; my $hl = $mw->HList(-itemtype=>'text')->pack; for my $n (0..5){ $hl->add($n , -text=>"Item $n", ); } $mw->bind('<Key-F1>',sub{$hl->selectionClear; $hl->anchorClear; $hl->selectionSet(0); $hl->anchorSet(0); } ); MainLoop; # by Christoph

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Cursor keys with Tk::Hlist goes wrong
by luke67m (Initiate) on Aug 29, 2014 at 17:10 UTC
    I have tried your suggestion but it does not solve the problem. I've binded the function to F3. After the problem appears , I press F3, the selection is repositioned at root(my 0 Is \) but, after this , the problem persist : pressing 5 up_key the cursor goes up 3 Times and down 2 Times(really strange...).
      You can find all the code (with your suggestion) at https://sourceforge.net/projects/copyandverify/files/ver0.010_ReplByDate/ . At the moment, the linux version has the itemcreate for col 0 commented and the add (with all attributes) active, so it works. If you search a line with all # you find the problematic code and your suggestion (on F3).