Another problem I am having. I would like the user to press enter in a
Textfield object and append the results to a RichEdit object. I have done
this before but for some reason it is not working now. Here is my code:
$ChatBox = $GameWindow->AddRichEdit(
-name => "ChatBox",
-left => 400,
-top => 5,
-width => 230,
-height => 330,
-disabled=> 1,
-addstyle=> WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_LEFT |
ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN,
-addexstyle=> WS_EX_CLIENTEDGE,
);
$ChatText = $GameWindow->AddTextfield(
-name => "ChatText",
-top => 345,
-left => 400,
-width => 175,
-height => 25,
-disabled=> 1,
-tabstop=> 1,
);
$Send = $GameWindow->AddButton(
-name => "SendText",
-text => "Send",
-top => 345,
-left => 580,
-height => 25,
-width => 50,
-tabstop=> 1,
-default=> 1,
-ok => 1,
-disabled=> 1,
);
and the subroutine for the button event:
sub SendText_Click {
if ($ChatText->Text() eq "") {
return;
}
my $OldText = $ChatBox->Text();
my $NewText = $ChatText->Text();
if ($OldText eq "") {
$ChatBox->Text("<$YourNick> $NewText");
} else {
$ChatBox->Text("$OldText\n<$YourNick> $NewText");
}
$ChatText->Text("");
$ChatText->SetFocus();
return;
}
Am I doing something wrong?
Jonathan Southwick
[EMAIL PROTECTED]
Technical & Network Services
Allegheny College, Meadville, PA 16335
(814) 332-2755