On 11/01/2008, Michael <[EMAIL PROTECTED]> wrote:
> Our team used Win32::GUI modules for several weeks and we made beautifuly GUI 
> windows by this
> excellent module. But there still had been a confusion: is there any event 
> designed to catch
> "Enter Key pressed" in Win32::GUI::TextField control? We tried "key down", 
> "char", all failed
> and seems no others available. The target is just to do some processing when 
> users finish their
> input by pressing the Enter key.

Enter key processing is a complicated area with Textfields,
particularly when they are used in a DialogBox rather than a main
window.  You did not post any code showing the exact problem you are
having, so I don't know if I'm answering your exact question.  Below
is some code the prints 'Return pressed' every time the enter key is
pressed in the Textfield.

Regards,
Rob.

#!perl -w
use strict;
use warnings;

use Win32::GUI 1.05 qw(CW_USEDEFAULT);

my $mw = Win32::GUI::Window->new(
    -title => "Enter Key and Textfield",
    -left  => CW_USEDEFAULT,
    -size  => [400,300],
);

$mw->AddTextfield(
    -pos       => [10,10],
    -size      => [100,100],
    -multiline => 1,
    -onChar    => \&char,
);

$mw->Show();
Win32::GUI::Dialog();
$mw->Hide();
exit(0);

sub char {
    my ($self, undef, $keyCode) = @_;

    if ($keyCode == 13) {
        print "Return pressed\n";
    }

    return 1;
}
__END__

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to