Scintilla is a very powerfull source code editor,
I am trying to test the Perl wrapper by Laurent Rocher,
below is the starting code from the Win32::GUI::Scintilla docs,
The only problem now I am having is how to activate the Folding
and how to use it, can anyone please post code on how to display
the folding margine and symbols etc. I see in the module functions
for folding but can not figure out how.
use Win32::GUI;
use Win32::GUI::Scintilla; # main Window
$|=1;
$Window = new Win32::GUI::Window (
-name => "Window",
-title => "Scintilla test",
-pos => [100, 100],
-size => [400, 400],
) or die "new Window"; # Create Scintilla Edit Window
# $Edit = new Win32::GUI::Scintilla (
# -parent => $Window,
# Or
$Edit = $Window->AddScintilla (
-name => "Edit",
-pos => [0, 0],
-size => [400, 400],
-text => "Test\n",
) or die "new Edit"; # Call Some method
$Edit->AddText ("add\n");
$Edit->AppendText ("append\n"); # Event loop
$Window->Show();
Win32::GUI::Dialog(); # Main window event handler
sub Window_Terminate {
# Call Some method
print "GetText = ", $Edit->GetText(), "\n";
print "GetSelText = ", $Edit->GetSelText(), "\n";
print "GetTextRange(2) = ", $Edit->GetTextRange(2), "\n";
print "GetTextRange(2, 6) = ", $Edit->GetTextRange(2, 6), "\n";
return -1;
}
# Main window resize
sub Window_Resize {
if (defined $Window) {
($width, $height) = ($Window->GetClientRect)[2..3];
$Edit->Move (0, 0);
$Edit->Resize ($width, $height);
}
}
# Scintilla Event Notification
sub Edit_Notify {
my (%evt) = @_;
print "Edit Notify = ", %evt, "\n";
}