Carol, Your code looked fine to me but didn't work when I ran it either so I looked at Aldo's PRIDE program and found that I could only get the keypress event to be called if I declared a new class and then made the richedit a member of that class:
my $EC = new Win32::GUI::Class( # Without this RichEdit KeyPress
Event doesn't get called
-name => "MyPerlRichEditClass",
-extends => "RichEdit",
-widget => "RichEdit",
);
$W->AddRichEdit(
-class => $EC,
-name => "Console",
-text => "",
-left => 5,
-top => 5,
-multiline => 1,
-width => $W->ScaleWidth-10,
-height => $W->ScaleHeight-10,
-exstyle => WS_EX_CLIENTEDGE,
-style => WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL
| ES_LEFT | ES_MULTILINE | ES_AUTOHSCROLL |
ES_AUTOVSCROLL,
);
I also found that if you want to use the change event you need to do
$W->Console->SendMessage(1093, 0, 1); # Enables Change Event for
RichEdit control
I'm afraid my knowledge of XS and the Win32 API isn't up to looking at
Aldo's code to find out why you need to do this.
I've included my modifications to your code the attachment.
Cheers,
Kev.
(See attached file: richedit.pl)
Carolyyne
Courtney To: [EMAIL PROTECTED]
<[EMAIL PROTECTED] cc:
tmail.com> Subject: Win32:: GUI Capturing the
enter key
15/06/2001
08:33
Kevin,
I still can't get this to work!
What am I doing wrong?
Carol
###
use strict;
use Win32::GUI;
my $M = new Win32::GUI::Menu(
"&Menu" => "menu",
" > &Exit" => "exit",
);
my $W = new Win32::GUI::Window(
-name => "main",
-text => "Test",
-left => 100,
-top => 100,
-width => 400,
-height => 300,
-menu => $M,
);
$W->AddRichEdit(
-name => "console",
-text => "enter something>",
-left => 5,
-top => 5,
-width => $W->ScaleWidth-10,
-height => $W->ScaleHeight-10,
);
#
$W->Show();
Win32::GUI::Dialog();
#
sub console_KeyPress {
my($key) = @_;
if ($key == 13) {
print "Enter pressed";
}
else {
print "$key";
}
}
sub exit_Click {
return -1;
}
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
richedit.pl
Description: Binary data

