Here is what I have been able to do so far. This is from reading the XS code, searching the sourceforge newsgroup, and searching the web.. Not much but a start.
#!perl
use strict;
use Win32::GUI;
################ MAIN WINDOW #############
my $MainWindow = new Win32::GUI::Window(
-name => "MainWindow",
-text => "Test",
-pos => [600,50],
-size => [415,320],
-noflicker=> 1,
);
##########################
my $left=0;
my $top=0;
my $width=400;
my $height=300;
#RichEdit References
#http://sourceforge.net/mailarchive/message.php?msg_id=245995 (way to
+ copy, etc)
#http://sourceforge.net/mailarchive/message.php?msg_id=245991 (Way to
+ append)
#http://sourceforge.net/mailarchive/message.php?msg_id=245926 (Richedi
+t Keypress, enter key, etc)
my $RE = $MainWindow->AddRichEdit(
-parent => $MainWindow,
-name => "RichEditControl",
-pos => [$left, $top ],
-size => [$width,$height],
-multiline => 1,
-vscroll=>1,
-autovscroll=>1,
);
#Set the eventmask so that the _onChange gets called
$RE->SendMessage (0x445, 0, 1);
#Turn on auto detect url
$RE->AutoURLDetect(1);
#Set max character length
$RE->SetMaxLength(5000);
#Set Background Color
$RE->SetBkgndColor(0xFFFFFF);
#Set Text Mode - This enables cut, copy, paste, undo, select all (No c
+ontext menu though)
$RE->SetTextMode(1,1);
#############################
$MainWindow->Show();
Win32::GUI::Dialog();
##############################
sub MainWindow_Resize{return 0;}
sub MainWindow_Minimize {return 0;}
sub MainWindow_Maximize {return 0;}
sub MainWindow_Terminate {return -1;}
sub RichEditControl_Change{
my $text=$MainWindow->RichEditControl->Text();
print "RichEditControl: $text\n";
}
sub RichEditControl_KeyPress{
my($key) = @_;
if ($key == 13){
print "Enter Key Pressed\n";
}
}
sub appendToRichEditControl{
my $text=shift || return;
$RE->Select (1e9, 1e9);
$RE->ReplaceSel ($text);
}
exit;
|