Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Cursor keys with Tk::Hlist goes wrong

by zentara (Archbishop)
on Aug 28, 2014 at 18:55 UTC ( [id://1098905]=note: print w/replies, xml ) Need Help??


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).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1098905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-23 12:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found