----- Original Message ----- 
From: "Dax T. Games" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 06, 2003 10:14 AM
Subject: Re[3]: Overiding default bindings in PerlTk


> Figured it out, mostly.
>
> This disables the arrow key bindings so they don't change the active cell but
it also disables using the arrow keys to navigate text strings within a cell.
Is it possible to turn off cell navigation but still be able to navigate within
a cell.
>
[code stripped]

There are many many class bindings in TableMatrix. The ones you use to navigate
"within" a cell are Control-Left and Control-Right (*arrows*). Try it and you
will see.

Now I'll forecast your next question:

"Now the "mybinding" *Left* and *Right* keys will trigger on a Control-Left and
Control-Right. How do I stop that from happening?"

Put a binding on your control key to set a program wide scoped variable to 1 if
pressed and 0 if released - say $ctrldown. Then simply do a:

return if ($ctrldown);

at the top of your subroutine. I realize that this won't stop your sub from
being called, but it shouldn't matter if you return immediately. This is the
easiest workaround.

Hint: The keysym for the Control key is *not* '<Control>'
Hint2: Most keyboards have two ctrl keys.
Hint3: To check your keysyms, you can run this simple program.

########################
use Tk;
use strict;

my $keysym;

my $mw=tkinit;
my $l1=$mw->Label(-textvariable=>\$keysym)->pack();
$keysym="Press Any Key";
$mw->focusForce;
$mw->bind('<Any-KeyPress>',\&get);
$mw->bind('<KeyRelease-Return>',
sub {print "You pressed the Enter key !!\n"});
MainLoop;

sub get
{
my $e=$mw->XEvent;
$keysym= "Keysym is"."\n".$e->K;
}
############################
Jack D.
Remove '__' from address if replying by e-mail.
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to