f



catch key stroke before displaying in an entry

Hello List

I have an application with a main window an several Entry's (input 
boxes). I would like to check the pressed key before it is displaied in 
the selected entry or even if no entry is selected (main window 
selected). I need this to determine if the input is comming from the 
keyboard or from a barcode scanner which is connected together with the 
keyboard (and acts like a keyboard, I can add some post chars for the 
barcode reader).

I tried to "bind" the "KeyPress" event to the main window and hoped this 
  will be the first callback which is called after pressing a key, but 
it seems to be the last callback. Then I could check the char and decide 
if  the callback should  break or the next call back should be executed.

I hope somebody can tell me an easy way to do this.

Thanks in advance,

Thomas
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
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
Thomas
10/4/2004 7:05:45 PM
comp.lang.perl.tk 4721 articles. 0 followers. pharrendorf (19) is leader. Post Follow

0 Replies
256 Views

Similar Articles

[PageSpeed] 23

Reply:

Similar Artilces:

Re: catch key stroke before displaying in an entry
At 03:05 PM 10/4/2004, Thomas Kaiser wrote: >I have an application with a main window an several Entry's (input boxes). I would like to check the pressed key before it is displaied in the selected entry or even if no entry is selected (main window selected). I need this to determine if the input is comming from the keyboard or from a barcode scanner which is connected together with the keyboard (and acts like a keyboard, I can add some post chars for the barcode reader). > >I tried to "bind" the "KeyPress" event to the main window and hoped this will be t...

catch key stroke before displaying in an entry #2
This is a multi-part message in MIME format. --------------080703050600080808050205 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit --------------080703050600080808050205 Content-Type: message/rfc822; name="catch key stroke before displaying in an entry" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="catch key stroke before displaying in an entry" Message-ID: <41619F09.5040905@kaiser.linux-site.net> Date: Mon, 04 Oct 2004 21:05:45 +0200 From: Thomas Kaiser <thomas@kaiser.linux-s...

catch key stroke before displaying in an entry #3
Hello Thanks for your tips. Here is my implementation of a barcode reader. # global variables my $BarCodeStart = 0; my $BarCodeEnd = 0; my $BarCode; my $EntryLength; $mw->bind("<KeyPress>", [ \&KeyPressed, Tk::Ev('K') ]); # Barcode format: degree <BARCODE> Return Control_L j sub KeyPressed { my $char = $_[1]; my ($widget) = @_; # End of Barcode if ($char eq "j" && $BarCodeStart == 1 && $BarCodeEnd == 1) { #Check if a Entry has the focus, if so, delete barcode if ($widget->isa('Tk::...

Re: catch key stroke before displaying in an entry #3
Thomas Kaiser <thomas@kaiser.linux-site.net> writes: >Hello List > >I have an application with a main window an several Entry's (input >boxes). I would like to check the pressed key before it is displaied in >the selected entry or even if no entry is selected (main window >selected). I need this to determine if the input is comming from the >keyboard or from a barcode scanner which is connected together with the >keyboard (and acts like a keyboard, I can add some post chars for the >barcode reader). > >I tried to "bind" the ...

Re: catch key stroke before displaying in an entry #2
Thomas, I just did this yesterday, but slightly differently. In my case, I have a series of data entry fields, which can be manually entered, or can be loaded from a 2d barcode (1d or 2d is irrelevant, however). The main trick is that most scanners can be set (or are by default?) to invoke the Return key following a scan. # Return key is invoked by barcode scanning. Trap this key # and see if a barcode was indeed scanned $mw->bind('<Return>' => \&handle_enter); Now, anyone can hit the return key, but it's easy enough to check to see if the data m...

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 #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 Accor...

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 #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 #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 #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 #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: 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 #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' ...

Web resources about - catch key stroke before displaying in an entry - comp.lang.perl.tk

List of mammals displaying homosexual behavior - Wikipedia, the free encyclopedia
For these mammals, there is documented evidence of homosexual behavior of one or more of the following kinds: sexual behavior , courtship , affection ...

Facebook Displaying Page Insights On Page Admins’ Personal Pages?
Some Facebook page administrators are seeing modules on their personal pages displaying page insights ad, campaign , and like totals for pages ...

Facebook Displaying Unread Messages from Pages in a New Updates Module
Facebook is displaying a new “Updates” sidebar module which shows some users unread messages sent to them by Pages. Users will see the Updates ...

Don Lemon Holds Up Sign Displaying the N-Word, Uncensored, on Air CNN Live - YouTube
Don Lemon Holds Up Sign Displaying the N-Word, Uncensored, on Air Lemon held up a Confederate flag first before holding up the sign. He asked, ...

Hazelwood coal mine fire: Morwell residents displaying symptoms similar to cigarette smokers, expert ...
An expert says some locals near Victoria's Hazelwood mine fire have symptoms similar to cigarette smokers.

Police accused of displaying fake G20 weapons
Toronto's top police officer misled the public by displaying fake weapons used in a medieval-themed role-playing game to help justify their actions ...

No charges for U.S. host for displaying high-capacity magazine on TV
NBC television journalist David Gregory won't face charges for displaying a high-capacity ammunition magazine on his "Meet the Press" news program ...

Jays' Escobar suspended three games for displaying slur
Toronto Blue Jays shortstop Yunel Escobar has been suspended three games for displaying a homophobic slur on his eye-black during a game on Saturday. ...

Google Play Store now displaying age-based ratings
We reported back in May that Google was adding age-based ratings to all apps in the Play Store as determined by the International Age Rating ...

Apple displaying Ferraris & other cars at WWDC hinting at CarPlay announcements
... 2014 Filed under: AAPL Company , iOS Continue reading more about AAPL Company and iOS at 9to5Mac . What do you think? Discuss "Apple displaying ...

Resources last updated: 2/6/2016 6:07:53 PM