Hi,

I've just submitted an addition for Win32::GUI v0.0.665 which adds the
keycode and extra info as arguments to the onKeyDown handler. This allows
you to do this, to create a single-line text entry field which detects a
press of the Enter key.

my $textfield = new Win32::GUI::Textfield ($win,
 -name => "textfield1",
 -left => 0,
 -top => 0,
 -width => 100,
 -height => 20
 -multiline => 1,
 -autohscroll => 1,
 -autovscroll => 0,
 -onKeyDown => \&keydown,
);

sub keydown {
 my ($additional_data,$keycode) = @_;
 if($keycode == 13) {
    print "Enter has been pressed.\n";
 }
}

Hopefully this will be included in the next CVS update, and will allow you
to get Enter presses without using that nasty "default button" method.

Steve

----- Original Message ----- 
From: "Johan Lindstrom" <[EMAIL PROTECTED]>
To: <perl-win32-gui-users@lists.sourceforge.net>
Sent: Wednesday, November 26, 2003 2:04 PM
Subject: Re: [perl-win32-gui-users] TextField entry


> At 01:58 2003-11-26, Ross Clunie wrote:
> >I would like to be able to use the ENTER key as an event trigger for a
> >textfeild. I have the _LostFocus event set and this works when the tab
key
> >is used but I would like ENTER key to emulate this function. Is it
poosible.
>
> Fake it by adding a button that is -ok and/or -default (I think -ok is an
> option proper). Turn off the -tabstop and put the button outside the
window
> (e.g. at 100000, 100000).
>
> The button's _Click event will be triggered when you press Enter in the
> Textfield.
>
>
> /J
>
> -------- ------ ---- --- -- --  --  -    -     -      -         -
> Johan Lindström    Sourcerer @ Boss Casinos     [EMAIL PROTECTED]
>
> Latest bookmark: "Oracle9i Database Concepts -- Contents"
>
<http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/toc.htm
>
> dmoz (1 of 7): /Computers/Internet/E-mail/Free/ 9
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?  SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
>


Reply via email to