Hi,

I'm using Win32::GUI::Scintilla package for my text editor and highlighting
multiple words (with whitespace), like this ;

"This is a test"  chars and whitespace highlighting but this code, not
highlighting whitespace chars.

How do i do this? "This is a test" (with whitespace highlight)

Thank you, Regards...

here is my codes;

# perl -v
use strict;
use Win32::GUI;
use Win32::GUI::Scintilla;

my %faces = ( 'times' => 'Times New Roman',
 'mono' => 'Courier New',
 'helv' => 'Lucida Console',
 'lucida' => 'Lucida Console',
 'other' => 'Comic Sans MS',
 'size' => '10',
 'size2' => '9',
 'backcol'=> '#FFFFFF',
 'backcolorhight' => '#28C50F',
 );

my $KEYWORD = q{
this is a test};



# main Window
my $Window = new Win32::GUI::Window (
 -name => "Window",
 -title => "Perl Editor",
 -pos => [100, 100],
 -size => [400, 400],
) or die "new Window";

my $Editor = $Window->AddScintilla (
 -name => "Editor",
 -pos => [0, 0],
 -size => [400, 400],
 -addexstyle => WS_EX_CLIENTEDGE,
 ) or die "new Edit";
# Init editor
Editor();


# Event loop
$Window->Show();
Win32::GUI::Dialog();



sub Editor {

#perl lexer
$Editor->SetLexer(Win32::GUI::Scintilla::SCLEX_PERL);

# Set Perl Keyword
$Editor->SetKeyWords(0, $KEYWORD);
# Win32::GUI::Scintilla::KEYWORDSET_MAX

# $Editor->SetKeyWords(0, $D);


 $Editor->SetProperty("fold", "1");
 $Editor->SetProperty("tab.timmy.whinge.level", "1");

 # Indenetation
 $Editor->SetIndentationGuides(1);
 $Editor->SetUseTabs(1);
 $Editor->SetTabWidth(3);
 $Editor->SetIndent(3);

 # Edge Mode
 $Editor->SetEdgeMode(Win32::GUI::Scintilla::EDGE_LINE); 
# $Editor->SetEdgeMode(Win32::GUI::Scintilla::EDGE_BACKGROUND);
 $Editor->SetEdgeColumn(0);
 $Editor->SetEdgeColour('00ff00');

 $Editor->SetMarginTypeN(1, Win32::GUI::Scintilla::SC_MARGIN_NUMBER);
 $Editor->SetMarginWidthN(1, 25);
 $Editor->SetFoldMarginColour(1, '00E5FF');

 $Editor->SetMarginTypeN(2, Win32::GUI::Scintilla::SC_MARGIN_SYMBOL);
 $Editor->SetFoldMarginColour(2, '00E5FF');
 $Editor->SetMarginMaskN(2, Win32::GUI::Scintilla::SC_MASK_FOLDERS);
 $Editor->SetMarginSensitiveN(2, 1);
 $Editor->SetMarginWidthN(2, 12);

 $Editor->MarkerDefine(Win32::GUI::Scintilla::SC_MARKNUM_FOLDEREND,
Win32::GUI::Scintilla::SC_MARK_BOXPLUSCONNECTED);
 $Editor->MarkerSetFore(Win32::GUI::Scintilla::SC_MARKNUM_FOLDEREND,
'#00FFFF');
 $Editor->MarkerSetBack(Win32::GUI::Scintilla::SC_MARKNUM_FOLDEREND,
'#000000');
 $Editor->MarkerDefine(Win32::GUI::Scintilla::SC_MARKNUM_FOLDEROPENMID,
Win32::GUI::Scintilla::SC_MARK_BOXMINUSCONNECTED);

$Editor->MarkerSetFore(Win32::GUI::Scintilla::SC_MARKNUM_FOLDEROPENMID,'#FFFFFF');

$Editor->MarkerSetBack(Win32::GUI::Scintilla::SC_MARKNUM_FOLDEROPENMID,'#000000');
 $Editor->MarkerDefine(Win32::GUI::Scintilla::SC_MARKNUM_FOLDERMIDTAIL,
Win32::GUI::Scintilla::SC_MARK_TCORNER);

$Editor->MarkerSetFore(Win32::GUI::Scintilla::SC_MARKNUM_FOLDERMIDTAIL,'#FFFFFF');

$Editor->MarkerSetBack(Win32::GUI::Scintilla::SC_MARKNUM_FOLDERMIDTAIL,'#000000');
 $Editor->MarkerDefine(Win32::GUI::Scintilla::SC_MARKNUM_FOLDERTAIL,
Win32::GUI::Scintilla::SC_MARK_LCORNER);
 $Editor->MarkerSetFore(Win32::GUI::Scintilla::SC_MARKNUM_FOLDERTAIL,
'#FFFFFF');
 $Editor->MarkerSetBack(Win32::GUI::Scintilla::SC_MARKNUM_FOLDERTAIL,
'#000000');
 $Editor->MarkerDefine(Win32::GUI::Scintilla::SC_MARKNUM_FOLDERSUB,
Win32::GUI::Scintilla::SC_MARK_VLINE);
 $Editor->MarkerSetFore(Win32::GUI::Scintilla::SC_MARKNUM_FOLDERSUB,
'#FFFFFF');
 $Editor->MarkerSetBack(Win32::GUI::Scintilla::SC_MARKNUM_FOLDERSUB,
'#000000');
 $Editor->MarkerDefine(Win32::GUI::Scintilla::SC_MARKNUM_FOLDER,
Win32::GUI::Scintilla::SC_MARK_BOXPLUS);
 $Editor->MarkerSetFore(Win32::GUI::Scintilla::SC_MARKNUM_FOLDER,
'#FFFFFF');
 $Editor->MarkerSetBack(Win32::GUI::Scintilla::SC_MARKNUM_FOLDER,
'#000000');
 $Editor->MarkerDefine(Win32::GUI::Scintilla::SC_MARKNUM_FOLDEROPEN,
Win32::GUI::Scintilla::SC_MARK_BOXMINUS);

$Editor->MarkerSetFore(Win32::GUI::Scintilla::SC_MARKNUM_FOLDEROPEN,'#FFFFFF');

$Editor->MarkerSetBack(Win32::GUI::Scintilla::SC_MARKNUM_FOLDEROPEN,'#000000');

 # Define Style
 $Editor->StyleClearAll();

 # Global default styles for all languages
 $Editor->StyleSetSpec(Win32::GUI::Scintilla::STYLE_DEFAULT,
"face:$faces{'mono'},size:$faces{'size'}");
 $Editor->StyleSetSpec(Win32::GUI::Scintilla::STYLE_LINENUMBER,
"back:#CCFF00,fore:#FF00FF,face:$faces{mono},bold");
 $Editor->StyleSetSpec(Win32::GUI::Scintilla::STYLE_CONTROLCHAR,
"face:$faces{mono}");
 $Editor->StyleSetSpec(Win32::GUI::Scintilla::STYLE_BRACELIGHT,
"fore:#FFFFFF,back:#0000FF,bold");
 $Editor->StyleSetSpec(Win32::GUI::Scintilla::STYLE_BRACEBAD,
"fore:#000000,back:#FF0000,bold");

 # White space
 # $Editor->StyleSetSpec (Win32::GUI::Scintilla::SCE_PL_DEFAULT,
"back:$faces{'backcolorhight'},fore:#B3FF00,bold,size:$faces{'size2'}");
 $Editor->StyleSetSpec (Win32::GUI::Scintilla::SCE_PL_WORD ,
"underline,size:$faces{'size2'}");#
"back:$faces{'backcolorhight'},fore:#B3FF00,bold,size:$faces{'size2'}"

}

# Main window event handler
sub Window_Terminate {-1}

sub Window_Resize {

 if (defined $Window) {
 my ($width, $height) = ($Window->GetClientRect)[2..3];
 $Editor->Move (0, 0);
 $Editor->Resize ($width, $height);
 }
}
-- 
View this message in context: 
http://old.nabble.com/How-to-highlight-mutliple-words-%28with-whitespace%29----Win32%3A%3AGUI%3A%3AScintilla--tp31412939p31412939.html
Sent from the perl-win32-gui-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
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