f



RE: malfunctioning keys in sun 10-key under Perl/Tk #2

Troy.A Johnson wrote:
> The problem we have is that using the 10 key 
> pad on our Sun model Type 5c keyboards almost 
> works. Everything is normal except:
> 
>   pressing '4' translates to 'left arrow'
>   pressing '6' translates to 'right arrow'

We worked around this same issue from the application side (see
discussion below).  It would be nice to get a real fix in place.

Dave Gordon
Micron Technology, Inc.


 -----Original Message-----
Sent:	Wednesday, September 29, 2004 2:42 PM
Subject:	RE: Tk Entry Widget issue

According to "perldoc Tk::bind", 

<snip>
$widget->bind(tag,sequence,callback) 
<snip>
If the tag is the name of a class of widgets, such as Tk::Button, the
binding applies to all widgets in that class; 
<snip>

So I haven't tried it, but maybe this would work:

$MW->bind('Tk::Entry', '<KeyPress>' =>
   sub {
      <same XEvent stuff as below>
   }
);


 -----Original Message-----
Sent:	Wednesday, September 29, 2004 2:33 PM
Subject:	RE: Tk Entry Widget issue

So I would have to do that for each Entry instance.

How does it work for the entire entry class?

 -----Original Message-----
Sent:	Wednesday, September 29, 2004 2:30 PM
Subject:	RE: Tk Entry Widget issue

We had this same issue on Sun keyboards with Perl 5.6.1 and Tk 800.023.
Not sure if this has been fixed in newer versions, but see the code
below for how we worked around it.  If I remember correctly, reassigning
the tag precedence order with "bindtags" unfortunately messed up the
-validate functionality of the entry widget.  Maybe the '<KeyPress>'
binding could have been bound to the entire Entry class instead of
individual Entry instances, and the "bindtags" would not have been
necessary.

	-- Dave

#!/usr/local/bin/perl -w 

use Tk;
use strict;

my $MW = MainWindow->new();

my $var;
my $e = $MW->Entry(
   -width => 8,
   -textvariable => \$var,
)->pack;
$e->focus;

fix_keypad($e);  # Fix Sun keypad for this widget

$MW->Button(
   -text => 'Exit',
   -command => sub {
      exit;
   },
)->pack;

MainLoop;

#-----------------------------------------------------------------------
-----
# Subroutine: fix_keypad
#
# Override keypress bindings so that Sun keypads work properly.
#-----------------------------------------------------------------------
-----
sub fix_keypad {
   my ($widget) = @_;

   $widget->bind('<KeyPress>' =>
      sub {
         my $e = $_[0]->XEvent;

         if ($e->A eq '4' and $e->K eq 'Left') {
            $_[0]->eventGenerate('<KeyPress>', -keysym => '4' );
            Tk->break;
         }
         elsif ($e->A eq '6' and $e->K eq 'Right') {
            $_[0]->eventGenerate('<KeyPress>', -keysym => '6' );
            Tk->break;
         }
         elsif ($e->A eq '.' and $e->K eq 'Delete') {
            $_[0]->eventGenerate('<KeyPress>', -keysym => 'period' );
            Tk->break;
         }
      }
   );
   $widget->bindtags([$widget,ref($widget),$widget->toplevel,'all']);
}

 -----Original Message-----
Sent:	Wednesday, September 29, 2004 1:34 PM
Subject:	Tk Entry Widget issue

Folks,
The 4 & 6 keys on certain key boards fail to recognize the 4 & 6 keys on
the ten key pad as anything other than a cursor left and a cursor right
even it the NumLock is on.
This happens in Unix on Windows.

The problem is that I can't just intercept the Left or Right from the
ten key and place what I need because then I lose my cursor keys.
(Yes, my users will use these keys in a single line entry widget)

Any ideas?
There is a lot of folks asking about this on the internet but I found no
solutions.

Thanks,
Mike

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu

0
dgordon
2/2/2005 6:39:11 PM
comp.lang.perl.tk 4721 articles. 0 followers. pharrendorf (19) is leader. Post Follow

0 Replies
394 Views

Similar Articles

[PageSpeed] 47

Reply:

Similar Artilces:

Re: malfunctioning keys in sun 10-key under Perl/Tk #10
"Troy.A Johnson" <troy.johnson@health.state.mn.us> wrote: > >>> konovalo <konovalo@mail.wplus.net> 03/15/05 12:34 AM >>> > >>>>The problem we have is that using the 10 key > >>>>pad on our Sun model Type 5c keyboards almost > >>>>works. Everything is normal except: > >>>>pressing '4' translates to 'left arrow' > >>>>pressing '6' translates to 'right arrow' > >>Also, running following code on Tcl/Tk interpreter: > >>pac...

Re: malfunctioning keys in sun 10-key under Perl/Tk
>The problem we have is that using the 10 key >pad on our Sun model Type 5c keyboards almost >works. Everything is normal except: > > pressing '4' translates to 'left arrow' > pressing '6' translates to 'right arrow' > > > is it true for any widget (e.g. Entry or Text) or you mean %K bind variable, and misbehaving only that? so "widget" demo also suffers this problem? In case this is true for all widgets, they try pure Tcl/Tk demo to check whether it also suffers same problem -++**==--++**==--++*...

Re: malfunctioning keys in sun 10-key under Perl/Tk #7
>>> konovalo <konovalo@mail.wplus.net> 02/02/05 2:55 PM >>> >>>The problem we have is that using the 10 key >>>pad on our Sun model Type 5c keyboards almost >>>works. Everything is normal except: >>> pressing '4' translates to 'left arrow' >>> pressing '6' translates to 'right arrow' >Also, running following code on Tcl/Tk interpreter: >pack [text .t] >will bring a Tcl/Tk GUI and widget on it for you to check behaviour Using 'wish' to check out: pack [ text .t...

Re: malfunctioning keys in sun 10-key under Perl/Tk #11
Re: bug report regarding numeric keypad You might try searching the bug database for strings like "pad". I did and noticed numerous similar reports which seem to keep being closed. -- Tcl - The glue of a new generation. <URL: http://wiki.tcl.tk/ > Larry W. Virden <mailto:lvirden@cas.org > <URL: http://www.purl.org/NET/lvirden/ > Even if explicitly stated to the contrary, nothing in this posting should be construed as representing my employer's opinions. -><- -++**==--++**==--++**==--++**==--++**==--++**==--++**== This message was posted...

Re: malfunctioning keys in sun 10-key under Perl/Tk #5
Hi! I have a question about a code snippet I found in the Mastering Perl/Tk book (chapter 15). I just wrapped it with a couple lines of code: ========== #!/usr/local/perl585/bin/perl -w use Tk; my $title = $ARGV[0] || $0; my $mw = new MainWindow; $mw->title($title); $mw->bind('KeyPress' => \&print_keysym); my $label = $mw->Label(-text => $title); $label->pack; my $entry = $mw->Entry(-width => 20); $entry->pack; my $button = $mw->Button(-text => "Exit", -command => sub { exit; }); $button->pack; ...

Re: malfunctioning keys in sun 10-key under Perl/Tk #3
>>> konovalo <konovalo@mail.wplus.net> 02/02/05 11:32 AM >>> >>The problem we have is that using the 10 key >>pad on our Sun model Type 5c keyboards almost >>works. Everything is normal except: >> pressing '4' translates to 'left arrow' >> pressing '6' translates to 'right arrow' >is it true for any widget (e.g. Entry or Text) or you mean %K bind >variable, and misbehaving only that? >so "widget" demo also suffers this problem? >In case this is true for all widgets, they tr...

Re: malfunctioning keys in sun 10-key under Perl/Tk #4
>>>The problem we have is that using the 10 key >>>pad on our Sun model Type 5c keyboards almost >>>works. Everything is normal except: >>> pressing '4' translates to 'left arrow' >>> pressing '6' translates to 'right arrow' >>> >>> >>is it true for any widget (e.g. Entry or Text) or you mean %K bind >>variable, and misbehaving only that? >>so "widget" demo also suffers this problem? >>In case this is true for all widgets, they try pure Tcl/Tk de...

Re: malfunctioning keys in sun 10-key under Perl/Tk #9
>>> konovalo <konovalo@mail.wplus.net> 03/15/05 12:34 AM >>> >>>>The problem we have is that using the 10 key >>>>pad on our Sun model Type 5c keyboards almost >>>>works. Everything is normal except: >>>>pressing '4' translates to 'left arrow' >>>>pressing '6' translates to 'right arrow' >>Also, running following code on Tcl/Tk interpreter: >>pack [text .t] >>will bring a Tcl/Tk GUI and widget on it for you to check behaviour >Using 'wish' ...

Re: malfunctioning keys in sun 10-key under Perl/Tk #8
>>>>The problem we have is that using the 10 key >>>>pad on our Sun model Type 5c keyboards almost >>>>works. Everything is normal except: >>>>pressing '4' translates to 'left arrow' >>>>pressing '6' translates to 'right arrow' >>>> >>>> >>Also, running following code on Tcl/Tk interpreter: >>pack [text .t] >>will bring a Tcl/Tk GUI and widget on it for you to check behaviour >> >> > >Using 'wish' to check o...

Re: malfunctioning keys in sun 10-key under Perl/Tk #6
At 02:28 PM 2/11/2005, Troy.A Johnson wrote: >The problem is that it doesn't seem to print anything at all. I made another >program to dump the bindings and nothing seems to get bound either. > >I think I must be doing something wrong, I just don't know what. Will someone >please give me a clue? Thanks in advance, sorry to bother you all. You should bind '<KeyPress>', not 'KeyPress'. -++**==--++**==--++**==--++**==--++**==--++**==--++**== This message was posted through the Stanford campus mailing list server. If you wish to unsubs...

Re: malfunctioning keys in sun 10-key under Perl/Tk #12
Note that I just tried, this morning, the patch found https://sourceforge.net/tracker/?func=detail&aid=481308&group_id=12997&atid=312997 and after hand editing the files to get the code in the right place, then doing a make clean and make, the resulting Tk library appears to handle the sun numeric keypad 'correctly'; that is to say: In num lock on mode, the 0-9 characters and the ., +, -, *, and / keys generate the corresponding characters. I'm uncertain what the Enter key is generating. In num lock off mode, the 2, 4, 6, 8 keys result in cursor motion. Th...

Re: Perl-tk cut and paste key bindings #2
Nick Ing-Simmons wrote: > The idea being to mimic key bindings that platform normaly provides. > Snag being that X11 isn't very regular in this regard. In particular > Control-C is no use in a terminal emulator window - as it kills the shell ;-) > What does Tcl/Tk do? > What do other X11 GUIs do (KDE/Gnome)? With the help of a few people with various different systems we have discovered that <Caps-Lock><Ctrl>c does the same as <Ctrl>c on every system and application where it does anything sensible. Also we have found that <Shift><C...

Re: Perl-tk cut and paste key bindings
Colin Tuckley <colin@tuckley.org> writes: >(cross posted from comp.lang.perl.tk where there was no response) > >We have a bug filed against the Debian package of perl-tk [1] which says >that "CAPS-LOCK + Ctrl + c does not copy into clipboard in TextUndo". I've >checked cut/paste in Windows XP applications and it does indeed work there. > >I've investigated and found that these key bindings are set in MainWindow.pm >and are thus active for the whole application. > >The bindings for cut, copy, paste, undo, and redo are set different...

Re: Perl-tk cut and paste key bindings #3
Colin Tuckley <colin@tuckley.org> writes: >Nick Ing-Simmons wrote: > >> The idea being to mimic key bindings that platform normaly provides. >> Snag being that X11 isn't very regular in this regard. In particular >> Control-C is no use in a terminal emulator window - as it kills the shell ;-) > >> What does Tcl/Tk do? >> What do other X11 GUIs do (KDE/Gnome)? > >With the help of a few people with various different systems we have >discovered that <Caps-Lock><Ctrl>c does the same as <Ctrl>c on every system ...

Web resources about - RE: malfunctioning keys in sun 10-key under Perl/Tk #2 - comp.lang.perl.tk

Mish on Malfunctioning Bureaucrats, Gold's Recent Decline and Chinese Chicken Feet! - YouTube
Watch more Capital Account @ http://www.youtube.com/CapitalAccount http://twitter.com/laurenlyster http://twitter.com/coveringdelta Thousands ...

Morgan Freeman lands malfunctioning plane en route to film premiere
Morgan Freeman, one of Hollywood's coolest voices has shown his cool head, landing a malfunctioning plane before abandoning it for second plane. ...

Movie World's Green Lantern ride malfunctioning, leaving people stranded
... have been rescued from the Green Lantern ride after it suddenly halted. Firefighters have safely removed all six trapped riders from a malfunctioning ...

US FDA to regulate only medical apps that could be risky if malfunctioning
The U.S. Food and Drug Administration intends to regulate only mobile apps that are medical devices and could pose a risk to a patient's safety ...

Movie World's Green Lantern ride malfunctioning, leaving people stranded: reports
... of carriage tipped 30 degrees and "my wife and I thought these people were dead". Fire crews have begun freeing trapped passengers from a malfunctioning ...

Malfunctioning Canadian space cameras removed from ISS
Two Canadian space cameras installed at the International Space Station last week have been removed for safety reasons.

The US: cornered by a malfunctioning system
The US: cornered by a malfunctioning system People's Daily Online ... of canvassing displays by politicians, but do not expect any genuine ...

Licking County Warning Siren Deactivated After Malfunctioning
Pataskala residents voice concerns after a malfunctioning warning siren was deactivated. Read more.

Investigators Exclusive: Incursion runway radar malfunctioning at Newark Liberty - 7online.com
The Eyewitness News Investigators looked into possible safety issues concerning air traffic controllers at Newark Liberty International Airport. ...

Former exec: Microsoft is ‘malfunctioning,’ Surface tablets are a huge mistake
... partners are too reliant on Windows to put up much of a fight, one former Microsoft executive thinks the company is "basically malfunctioning" ...

Resources last updated: 2/6/2016 1:53:41 PM