
Win32::GUI::Scintilla - Add Scintilla edit control to Win32::GUI

use Win32::GUI;
use Win32::GUI::Scintilla;
# main Window
$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";
}

Scintilla is a free source code editing component. http://www.scintilla.org/
new (...)Create a new Scintilla control.
Parameter : -name : Window name -parent : Parent window
-left : Left position
-top : Top position
-width : Width
-height : Height
-pos : [x, y] position
-size : [w, h] size
-text : Text
-visible : Visible
-readonly : ReadOnly
-hscroll : Horizontal scroll
-vscroll : Vertical scroll
-pushstyle : Push style
-addstyle : Add style
-popstyle : Pop style
-remstyle : Remove style
-notstyle : Not style
-negstyle : Negation style
-exstyle : Extended style
-pushexstyle : Push extended style
-addexstyle : Add extended style
-popexstyle : Pop extended style
-remexstyle : Remove extended style
-notexstyle : Not extended style
-negexstyle : Negation extended style
Win32::GUI::Window::AddScintilla (...)Add a scintilla control in a Win32::GUI::Window. Parent window is automaticly add to new method. See Win32::GUI::Scintilla new method for parameters.
Notify (%evt) -code : Event Code
SCN_STYLENEEDED
-position
SCN_CHARADDED
-ch : Character
SCN_KEY
-ch : Character
-modifiers : Key mask
-shift : Shift key
-control : Control key
-alt : Alt key
SCN_MODIFIED
-position : Position
-modificationType :
-length : Length
-linesAdded : Line added
-line : Line
-foldLevelNow :
-foldLevelPrev :
SCN_MACRORECORD
-message : Message
SCN_MARGINCLICK
-position
-modifiers : Key mask
-shift : Shift key
-control : Control key
-alt : Alt key
-margin : Margin number
SCN_USERLISTSELECTION
-listType : List item
SCN_DWELLSTART
-position : Position
-x : X position
-y : Y position
SCN_DWELLEND
-position : Position
-x : X position
-y : Y position
SCN_SAVEPOINTREACHED
SCN_SAVEPOINTLEFT
SCN_MODIFYATTEMPTRO
SCN_DOUBLECLICK
SCN_UPDATEUI
SCN_ZOOM
SCN_URIDROPPED
SCN_NEEDSHOWN
SCN_PAINTED
SCN_HOTSPOTCLICK & SCN_HOTSPOTDOUBLECLICK
-position : Position
-modifiers : Key mask
-shift : Shift key
-control : Control key
-alt : Alt key
SCN_CALLTIPCLICK
-position : Position
ChangeFire when Scintilla edit control text change. See also Notify SCN_MODIFIED event.
GotFocusFire when Scintilla edit control got focus.
LostFocusFire when Scintilla edit control lost focus.
NewFileClean control for editing a new file. - Clear Text - Clear Undo buffer - Set save point
LoadFile (filename)Load a text file. - Clear undo buffer - Set save point
Return : bool
SaveFile (filename)Save text in file. - Set save point
Return : bool
StyleSetSpec (style, stringstyle)Set a style from a string style.
A string style is a comma separated property string. Each property, is compose a property name, an optional value separate by a ':'.
Property : - fore:#RRGGBB = Set foreground color (RRGGBB is a hexadecimal value) - back:#RRGGBB = Set background color - face:name = Set font - size:N = Set font size (N is a numeric value) - bold = Bold font - notbold = Not Bold font - italic = Italic font - notitalic = Not Italic font - underline = Underline font - notunderline = Not Underline font - eolfilled = eolfilled - noteolfilled = Not eolfilled
Sample : "face:Times New Roman,size:12,fore:#0000FF,back#FF0000,bold,italic"
BraceHighEvent (bracematch = "[](){}")A standard brace highlighting event manager.
FolderEvent (%evt)A standard event manager.
If Shift and Control are pressed, open or close all folder
Else
If Shift is pressed, Toggle 1 level of current folder
Else If Control is pressed, expand all subfolder of current folder
Else Toggle current folder
FolderAllFolding or Unfolding all text.
FolderExpand (line, doExpand, force=0, visLevel=0, level=-1)Manage Folder Expanding
FindAndSelect (text, flag = SCFIND_WHOLEWORD, direction=1, wrap=1)Find a text and select it.
Parameter: - text : Text to find (or regular expression). - flag : A Scintilla Find constante. SCFIND_WHOLEWORD SCFIND_MATCHCASE SCFIND_WORDSTART SCFIND_REGEXP
- direction : ForWard >= 0, Backward < 0
- wrap : Use Wrap mode.
For full documentation of Scintilla control see http://www.scintilla.org/
AddText (text)Add text to the document.
AddStyledText (styledtext)Add array of cells to document.
InsertText (position, text)Insert string at a position.
ClearAllDelete all text in the document.
ClearDocumentStyleSet all style bytes to 0, remove all folding information.
GetLengthReturn the number of characters in the document.
GetCharAt (position)Returns the character byte at the position.
GetCurrentPosReturns the position of the caret.
GetAnchorReturns the position of the opposite end of the selection to the caret.
GetStyleAt (position)Returns the style byte at the position.
RedoRedoes the next action on the undo history.
SetUndoCollection (collectUndo)Choose between collecting actions into the undo history and discarding them.
SelectAllSelect all the text in the document.
SetSavePointRemember the current position in the undo history as the position at which the document was saved.
GetStyledText (start=0, end=TextLength)Returns the number of bytes in the buffer not including terminating NULs.
CanRedoAre there any redoable actions in the undo history?
MarkerLineFromHandle (handle)Retrieve the line number at which a particular marker is located.
MarkerDeleteHandle (handle)Delete a marker.
GetUndoCollectionIs undo history being collected?
WS ConstantSCWS_INVISIBLE, SCWS_VISIBLEALWAYS, SCWS_VISIBLEAFTERINDENT
GetViewWSAre white space characters currently visible?
SetViewWS (viewWS)Make white space characters invisible, always visible or visible outside indentation.
PositionFromPoint (x, y)Find the position from a point within the window.
PositionFromPointClose (x, y)Find the position from a point within the window but return INVALID_POSITION if not close to text.
GotoLine (line)Set caret to start of a line and ensure it is visible.
GotoPos (position)Set caret to a position and ensure it is visible.
SetAnchor (position)Set the selection anchor to a position. The anchor is the opposite end of the selection from the caret.
GetCurLineReturn the text of the line containing the caret.
GetEndStyledRetrieve the position of the last correctly styled character.
EOL constantSC_EOL_CRLF, SC_EOL_CR, SC_EOL_LF.
ConvertEOLs (eolMode)Convert all line endings in the document to one mode.
GetEOLModeRetrieve the current end of line mode - one of CRLF, CR, or LF.
SetEOLMode (eolMode)Set the current end of line mode.
StartStyling (position, mask)Set the current styling position to pos and the styling mask to mask. The styling mask can be used to protect some bits in each styling byte from modification.
SetStyling (length, style)Change style from current styling position for length characters to a style and move the current styling position to after this newly styled segment.
GetBufferedDrawIs drawing done first into a buffer or direct to the screen?
SetBufferedDraw (buffered)If drawing is buffered then each line of text is drawn into a bitmap buffer before drawing it to the screen to avoid flicker.
SetTabWidth (tabWidth)Change the visible size of a tab to be a multiple of the width of a space character.
GetTabWidthRetrieve the visible size of a tab.
Constant code pageSC_CP_UTF8, SC_CP_DBCS
SetCodePage (codepage)Set the code page used to interpret the bytes of the document as characters.
SetUsePalette (usePalette)In palette mode, Scintilla uses the environment's palette calls to display more colours. This may lead to ugly displays.
MARK constantShapes SC_MARK_CIRCLE SC_MARK_ROUNDRECT SC_MARK_ARROW SC_MARK_SMALLRECT SC_MARK_SHORTARROW SC_MARK_EMPTY SC_MARK_ARROWDOWN SC_MARK_MINUS SC_MARK_PLUS Shapes used for outlining column. SC_MARK_VLINE SC_MARK_LCORNER SC_MARK_TCORNER SC_MARK_BOXPLUS SC_MARK_BOXPLUSCONNECTED SC_MARK_BOXMINUS SC_MARK_BOXMINUSCONNECTED SC_MARK_LCORNERCURVE SC_MARK_TCORNERCURVE SC_MARK_CIRCLEPLUS SC_MARK_CIRCLEPLUSCONNECTED SC_MARK_CIRCLEMINUS SC_MARK_CIRCLEMINUSCONNECTED Invisible mark that only sets the line background color. SC_MARK_BACKGROUND SC_MARK_DOTDOTDOT SC_MARK_ARROWS SC_MARK_PIXMAP SC_MARK_CHARACTER Markers used for outlining column. SC_MARKNUM_FOLDEREND SC_MARKNUM_FOLDEROPENMID SC_MARKNUM_FOLDERMIDTAIL SC_MARKNUM_FOLDERTAIL SC_MARKNUM_FOLDERSUB SC_MARKNUM_FOLDER SC_MARKNUM_FOLDEROPEN Mask folder SC_MASK_FOLDERS
MarkerDefine (markerNumber, markerSymbol)Set the symbol used for a particular marker number.
MarkerSetFore (markerNumber, fore)Set the foreground colour used for a particular marker number.
MarkerSetBack (markerNumber, back)Set the background colour used for a particular marker number.
MarkerAdd (line, markerNumber)Add a marker to a line, returning an ID which can be used to find or delete the marker.
MarkerDelete (line, markerNumber)Delete a marker from a line.
MarkerDeleteAll (markerNumber)Delete all markers with a particular number from all lines.
MarkerGet (line)Get a bit mask of all the markers set on a line.
MarkerNext (lineStart, markerMask)Find the next line after lineStart that includes a marker in mask.
MarkerPrevious (lineStart, markerMask)Find the previous line before lineStart that includes a marker in mask.
MarkerDefinePixmap (markerNumber, pixmap)Define a marker from a pixmap.
MarkerAddSet (line, set)Add a set of markers to a line.
MARGIN constantSC_MARGIN_SYMBOL, SC_MARGIN_NUMBER
SetMarginTypeN (margin, marginType)Set a margin to be either numeric or symbolic.
GetMarginTypeN (margin)Retrieve the type of a margin.
SetMarginWidthN (margin, pixelWidth)Set the width of a margin to a width expressed in pixels.
GetMarginWidthN (margin)Retrieve the width of a margin in pixels.
SetMarginMaskN (margin, mask)Set a mask that determines which markers are displayed in a margin.
GetMarginMaskN (margin)Retrieve the marker mask of a margin.
SetMarginSensitiveN (margin, sensitive)Make a margin sensitive or insensitive to mouse clicks.
GetMarginSensitiveN (margin)Retrieve the mouse click sensitivity of a margin.
Style constantStyles in range 32..37 are predefined for parts of the UI and are not used as normal styles. Styles 38 and 39 are for future use. STYLE_DEFAULT STYLE_LINENUMBER STYLE_BRACELIGHT STYLE_BRACEBAD STYLE_CONTROLCHAR STYLE_INDENTGUIDE STYLE_LASTPREDEFINED STYLE_MAX
StyleClearAllClear all the styles and make equivalent to the global default style.
StyleSetFore (style, color)Set the foreground colour of a style. Color format : '#RRGGBB'
StyleSetBack (style, color)Set the background colour of a style. Color format : '#RRGGBB'
StyleSetBold (style, bool)Set a style to be bold or not.
StyleSetItalic (style, bool)Set a style to be italic or not.
StyleSetSize (style, size)Set the size of characters of a style.
StyleSetFont (style, fontname)Set the font of a style.
StyleSetEOLFilled (style, bool)Set a style to have its end of line filled or not.
StyleResetDefaultReset the default style to its state at startup
StyleSetUnderline (style, bool)Set a style to be underlined or not.
CASE constantSC_CASE_MIXED SC_CASE_UPPER SC_CASE_LOWER
StyleSetCase (style, case)Set a style to be mixed case, or to force upper or lower case.
CHARSET constantSC_CHARSET_ANSI SC_CHARSET_DEFAULT SC_CHARSET_BALTIC SC_CHARSET_CHINESEBIG5 SC_CHARSET_EASTEUROPE SC_CHARSET_GB2312 SC_CHARSET_GREEK SC_CHARSET_HANGUL SC_CHARSET_MAC SC_CHARSET_OEM SC_CHARSET_RUSSIAN SC_CHARSET_SHIFTJIS SC_CHARSET_SYMBOL SC_CHARSET_TURKISH SC_CHARSET_JOHAB SC_CHARSET_HEBREW SC_CHARSET_ARABIC SC_CHARSET_VIETNAMESE SC_CHARSET_THAI
StyleSetCharacterSet (style, characterSet)Set the character set of the font in a style.
StyleSetHotSpot (style, hotspot)Set a style to be a hotspot or not.
SetSelFore (useSetting, color)Set the foreground colour of the selection and whether to use this setting.
SetSelBack (useSetting, color)Set the background colour of the selection and whether to use this setting.
SetCaretFore (color)Set the foreground colour of the caret.
AssignCmdKey (key, modifiers, msg)When key+modifier combination km is pressed perform msg.
ClearCmdKey (key, modifiers)When key+modifier combination km is pressed do nothing.
ClearAllCmdKeysDrop all key mappings.
SetStylingEx (length, styles)Set the styles for a segment of the document.
StyleSetVisible (style, bool)Set a style to be visible or not.
GetCaretPeriodGet the time in milliseconds that the caret is on and off.
SetCaretPeriod (period)Set the time in milliseconds that the caret is on and off. 0 = steady on.
SetWordChars (characters)Set the set of characters making up words for when moving or selecting by word. First sets defaults like SetCharsDefault.
BeginUndoActionStart a sequence of actions that is undone and redone as a unit.
EndUndoActionEnd a sequence of actions that is undone and redone as a unit.
STYLE constantINDIC_PLAIN INDIC_SQUIGGLE INDIC_TT INDIC_DIAGONAL INDIC_STRIKE INDIC_HIDDEN INDIC_BOX INDIC0_MASK INDIC1_MASK INDIC2_MASK INDICS_MASK
IndicSetStyle (indic, style)Set an indicator to plain, squiggle or TT.
IndicGetStyle (indic)Retrieve the style of an indicator.
IndicSetFore (indic, color)Set the foreground colour of an indicator
IndicGetFore (indic)Retrieve the foreground colour of an indicator.
SetWhitespaceFore (useSetting, color)Set the foreground colour of all whitespace and whether to use this setting.
SetWhitespaceBack (useSetting, color)Set the background colour of all whitespace and whether to use this setting.
SetStyleBits (bits)Divide each styling byte into lexical class bits (default: 5) and indicator bits (default: 3). If a lexer requires more than 32 lexical states, then this is used to expand the possible states.
GetStyleBitsRetrieve number of bits in style bytes used to hold the lexical state.
SetLineState (line, state)Used to hold extra styling information for each line.
GetLineState (line)Retrieve the extra styling information for a line.
GetMaxLineStateRetrieve the last line number that has line state.
GetCaretLineVisibleIs the background of the line containing the caret in a different colour?
SetCaretLineVisible (show)Display the background of the line containing the caret in a different colour.
GetCaretLineBackGet the colour of the background of the line containing the caret.
SetCaretLineBack (color)Set the colour of the background of the line containing the caret.
StyleSetChangeable (style, bool)Set a style to be changeable or not (read only).
AutoCShow (lenEntered, itemList))Display a auto-completion list. The lenEntered parameter indicates how many characters before the caret should be used to provide context.
AutoCCancelRemove the auto-completion list from the screen.
AutoCActiveIs there an auto-completion list visible?
AutoCPosStartRetrieve the position of the caret when the auto-completion list was displayed.
AutoCCompleteUser has selected an item so remove the list and insert the selection.
AutoCStops (characterSet)Define a set of character that when typed cancel the auto-completion list.
AutoCSetSeparator (characterSet)Change the separator character in the string setting up an auto-completion list. Default is space but can be changed if items contain space.
AutoCGetSeparatorRetrieve the auto-completion list separator character.
AutoCSelect (text)Select the item in the auto-completion list that starts with a string.
AutoCSetCancelAtStart (cancel)Should the auto-completion list be cancelled if the user backspaces to a position before where the box was created.
AutoCGetCancelAtStartRetrieve whether auto-completion cancelled by backspacing before start.
AutoCSetFillUps (characterSet)Define a set of characters that when typed will cause the autocompletion to choose the selected item.
AutoCSetChooseSingle (chooseSingle)Should a single item auto-completion list automatically choose the item.
AutoCGetChooseSingleRetrieve whether a single item auto-completion list automatically choose the item.
AutoCSetIgnoreCase (ignoreCase)Set whether case is significant when performing auto-completion searches.
AutoCGetIgnoreCaseRetrieve state of ignore case flag.
UserListShow (listType, itemList)Display a list of strings and send notification when user chooses one.
AutoCSetAutoHide (autoHide)Set whether or not autocompletion is hidden automatically when nothing matches.
AutoCGetAutoHideRetrieve whether or not autocompletion is hidden automatically when nothing matches.
AutoCSetDropRestOfWord (auutoHide)Retrieve whether or not autocompletion is hidden automatically when nothing matches.
AutoCGetDropRestOfWordRetrieve whether or not autocompletion is hidden automatically when nothing matches.
RegisterImage (type, xpmData)Register an XPM image for use in autocompletion lists.
ClearRegisteredImagesClear all the registered XPM images.
AutoCGetTypeSeparatorRetrieve the auto-completion list type-separator character.
AutoCSetTypeSeparatorChange the type-separator character in the string setting up an auto-completion list. Default is '?' but can be changed if items contain '?'.
AutoCGetMaxHeightSet the maximum height, in rows, of auto-completion and user lists.
AutoCSetMaxHeight (rowCount)Set the maximum height, in rows, of auto-completion and user lists. The default is 5 rows.
AutoCGetMaxWidthGet the maximum width, in characters, of auto-completion and user lists.
AutoCSetMaxWidth (characterCount)Set the maximum width, in characters, of auto-completion and user lists. Set to 0 to autosize to fit longest item, which is the default.
SetIndent (indentSize)Set the number of spaces used for one level of indentation.
GetIndentRetrieve indentation size.
SetUseTabs (useTabs)Indentation will only use space characters if useTabs is false, otherwise it will use a combination of tabs and spaces.
GetUseTabsRetrieve whether tabs will be used in indentation.
SetLineIndentation (line, indentSize)Change the indentation of a line to a number of columns.
GetLineIndentation (line)Retrieve the number of columns that a line is indented.
GetLineIndentPosition (line)Retrieve the position before the first non indentation character on a line.
GetColumn (pos)Retrieve the column number of a position, taking tab width into account.
SetHScrollBar (show)Show or hide the horizontal scroll bar.
GetHScrollBarIs the horizontal scroll bar visible?
SetIndentationGuides (bool)Show or hide indentation guides.
GetIndentationGuidesAre the indentation guides visible?
SetHighlightGuide (column)Set the highlighted indentation guide column. 0 = no highlighted guide.
GetHighlightGuideGet the highlighted indentation guide column.
GetLineEndPosition (line)Get the position after the last visible characters on a line.
GetCodePageGet the code page used to interpret the bytes of the document as characters.
GetCaretFore (color)Get the foreground colour of the caret.
GetUsePaletteIn palette mode?
GetReadOnlyIn read-only mode?
SetCurrentPos (position)Sets the position of the caret.
SetSelectionStart (position)Sets the position that starts the selection - this becomes the anchor.
GetSelectionStartReturns the position at the start of the selection.
SetSelectionEnd (position)Sets the position that ends the selection - this becomes the currentPosition.
GetSelectionEndReturns the position at the start of the selection.
SetPrintMagnification (magnification)Sets the print magnification added to the point size of each style for printing.
GetPrintMagnificationReturns the print magnification.
PRINT constantPrintColourMode - use same colours as screen. SC_PRINT_NORMAL PrintColourMode - invert the light value of each style for printing. SC_PRINT_INVERTLIGHT PrintColourMode - force black text on white background for printing. SC_PRINT_BLACKONWHITE PrintColourMode - text stays coloured, but all background is forced to be white for printing. SC_PRINT_COLOURONWHITE PrintColourMode - only the default-background is forced to be white for printing. SC_PRINT_COLOURONWHITEDEFAULTBG
SetPrintColourMode (mode)Modify colours when printing for clearer printed text.
GetPrintColourModeReturns the print colour mode.
FIND constantSCFIND_WHOLEWORD SCFIND_MATCHCASE SCFIND_WORDSTART SCFIND_REGEXP SCFIND_POSIX
FindText (textToFind, start=0, end=GetLength(), flag = SCFIND_WHOLEWORD)Find some text in the document.
FormatRange (start=0, end=GetLength(), draw=1)On Windows, will draw the document into a display context such as a printer.
GetFirstVisibleLineRetrieve the display line at the top of the display.
GetLine (line)Return text of line.
GetLineCountReturns the number of lines in the document. There is always at least one.
SetMarginLeft (pixelWidth)Sets the size in pixels of the left margin.
GetMarginLeftReturns the size in pixels of the left margin.
SetMarginRight (pixelWidth)Sets the size in pixels of the right margin.
GetMarginRightReturns the size in pixels of the right margin.
GetModifyIs the document different from when it was last saved?
SetSel (start, end)Select a range of text.
GetSelTextRetrieve the selected text.
GetTextRange (start=0, end=Length)Retrieve a range of text.
HideSelection (normal)Draw the selection in normal style or with selection highlighted.
PointXFromPosition (position)Retrieve the x value of the point in the window where a position is displayed.
PointYFromPosition (position)Retrieve the y value of the point in the window where a position is displayed.
LineFromPosition (position)Retrieve the line containing a position.
PositionFromLine (line)Retrieve the position at the start of a line.
LineScroll (columns, lines)Scroll horizontally and vertically.
ScrollCaretEnsure the caret is visible.
ReplaceSel (text)Replace the selected text with the argument text.
SetReadOnly (bool)Set to read only or read write.
NullNull operation.
CanPasteWill a paste succeed?
CanUndoAre there any undoable actions in the undo history?
EmptyUndoBufferDelete the undo history.
UndoUndo one action in the undo history.
CutCut the selection to the clipboard.
CopyCopy the selection to the clipboard.
PastePaste the contents of the clipboard into the document replacing the selection.
ClearClear the selection.
SetText (text)Replace the contents of the document with the argument text.
GetTextRetrieve all the text in the document.
GetTextLengthRetrieve the number of characters in the document.
GetDirectFunctionRetrieve a pointer to a function that processes messages for this Scintilla.
GetDirectPointerRetrieve a pointer to a function that processes messages for this Scintilla.
SetOvertype (overtype)Set to overtype (true) or insert mode.
GetOvertypeReturns true if overtype mode is active otherwise false is returned.
SetCaretWidth (pixelWidth)Set the width of the insert mode caret.
GetCaretWidthReturns the width of the insert mode caret.
SetTargetStart (position)Sets the position that starts the target which is used for updating the document without affecting the scroll position.
GetTargetStartGet the position that starts the target.
SetTargetEnd (position)Sets the position that ends the target which is used for updating the document without affecting the scroll position.
GetTargetEndGet the position that ends the target.
ReplaceTarget (text)Replace the target text with the argument text. Text is counted so it can contain NULs. Returns the length of the replacement text.
ReplaceTargetRE ($text)Replace the target text with the argument text after \d processing. Text is counted so it can contain NULs. Looks for \d where d is between 1 and 9 and replaces these with the strings matched in the last search operation which were surrounded by \( and \). Returns the length of the replacement text including any change caused by processing the \d patterns
SearchInTarget (text)Search for a counted string in the target and set the target to the found range. Text is counted so it can contain NULs. Returns length of range or -1 for failure in which case target is not moved.
SetSearchFlags (flags)Set the search flags used by SearchInTarget.
GetSearchFlagsGet the search flags used by SearchInTarget.
CallTipShow (position, definition)Show a call tip containing a definition near position pos.
CallTipCancelRemove the call tip from the screen.
CallTipActiveIs there an active call tip?
CallTipPosStartRetrieve the position where the caret was before displaying the call tip.
CallTipSetHlt (start, end)Highlight a segment of the definition.
CallTipSetBack (color)Set the background colour for the call tip.
CallTipSetFore (color)Set the foreground colour for the call tip.
CallTipSetForeHlt (color)Set the foreground colour for the highlighted part of the call tip.
CallTipUseStyle (tabSize)Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
VisibleFromDocLine (line)Find the display line of a document line taking hidden lines into account.
DocLineFromVisible (lineDisplay)Find the document line of a display line taking hidden lines into account.
WrapCount (line)The number of display lines needed to wrap a document line
FOLDERLEVEL constantSC_FOLDLEVELBASE SC_FOLDLEVELWHITEFLAG SC_FOLDLEVELHEADERFLAG SC_FOLDLEVELBOXHEADERFLAG SC_FOLDLEVELBOXFOOTERFLAG SC_FOLDLEVELCONTRACTED SC_FOLDLEVELUNINDENT SC_FOLDLEVELNUMBERMASK
SetFoldLevel (line, level)Set the fold level of a line. This encodes an integer level along with flags indicating whether the line is a header and whether it is effectively white space.
GetFoldLevel (line)Retrieve the fold level of a line.
GetLastChild (line, level)Find the last child line of a header line.
GetFoldParent (line)Find the parent line of a child line.
ShowLines (lineStart, lineEnd)Make a range of lines visible.
HideLines (lineStart, lineEnd)Make a range of lines invisible.
GetLineVisible (line)Is a line visible?
SetFoldExpanded (line, expanded)Show the children of a header line.
GetFoldExpanded (line)Is a header line expanded ?
ToggleFold (line)Switch a header line between expanded and contracted.
EnsureVisible (line)Ensure a particular line is visible by expanding any header line hiding it.
FOLDFLAG constantSC_FOLDFLAG_LINEBEFORE_EXPANDED SC_FOLDFLAG_LINEBEFORE_CONTRACTED SC_FOLDFLAG_LINEAFTER_EXPANDED SC_FOLDFLAG_LINEAFTER_CONTRACTED SC_FOLDFLAG_LEVELNUMBERS SC_FOLDFLAG_BOX
SetFoldFlags (flags)Set some style options for folding.
EnsureVisibleEnforcePolicy (line)Ensure a particular line is visible by expanding any header line hiding it. Use the currently set visibility policy to determine which range to display.
SetTabIndents (tabIndents)Sets whether a tab pressed when caret is within indentation indents.
GetTabIndentsDoes a tab pressed when caret is within indentation indent?
SetBackSpaceUnIndents (bsUnIndents)Sets whether a backspace pressed when caret is within indentation unindents.
GetBackSpaceUnIndentsDoes a backspace pressed when caret is within indentation unindent?
TIME constantSC_TIME_FOREVER
SetMouseDwellTime (period)Sets the time the mouse must sit still to generate a mouse dwell event.
GetMouseDwellTimeRetrieve the time the mouse must sit still to generate a mouse dwell event.
WordStartPosition (pos, onlyWordCharacters)Get position of start of word.
WordEndPosition (pos, onlyWordCharacters)Get position of end of word.
WRAP constantSC_WRAP_NONE SC_WRAP_WORD SC_WRAP_CHAR
SetWrapMode (mode)Sets whether text is word wrapped.
GetWrapModeRetrieve whether text is word wrapped.
WRAPVISUALFLAG constantSC_WRAPVISUALFLAG_NONE SC_WRAPVISUALFLAG_END SC_WRAPVISUALFLAG_START
SetWrapVisualFlags (wrapVisualFlags)Set the display mode of visual flags for wrapped lines.
GetWrapVisualFlagsRetrive the display mode of visual flags for wrapped lines.
WRAPVISUALFLAGLOC constantSC_WRAPVISUALFLAGLOC_DEFAULT SC_WRAPVISUALFLAGLOC_END_BY_TEXT SC_WRAPVISUALFLAGLOC_START_BY_TEXT
SetWrapVisualFlagsLocation (wrapVisualFlagsLocation)Set the location of visual flags for wrapped lines.
GetWrapVisualFlagsLocationRetrive the location of visual flags for wrapped lines.
SetWrapStartIndent (indent)Set the start indent for wrapped lines.
GetWrapStartIndentRetrive the start indent for wrapped lines.
CACHE constantSC_CACHE_NONE SC_CACHE_CARET SC_CACHE_PAGE SC_CACHE_DOCUMENT
SetLayoutCache (mode)Sets the degree of caching of layout information.
GetLayoutCacheRetrieve the degree of caching of layout information.
SetScrollWidth (pixelWidth)Sets the document width assumed for scrolling.
GetScrollWidthRetrieve the document width assumed for scrolling.
TextWidth (style, text)Measure the pixel width of some text in a particular style. NUL terminated text argument. Does not handle tab or control characters.
SetEndAtLastLine (endAtLastLine)Sets the scroll range so that maximum scroll position has the last line at the bottom of the view (default). Setting this to false allows scrolling one page below the last line.
GetEndAtLastLineRetrieve whether the maximum scroll position has the last line at the bottom of the view.
TextHeight (line)Retrieve the height of a particular line of text in pixels.
SetVScrollBar (bool)Show or hide the vertical scroll bar.
GetVScrollBarIs the vertical scroll bar visible?
AppendText (text)Append a string to the end of the document without changing the selection.
GetTwoPhaseDrawIs drawing done in two phases with backgrounds drawn before faoregrounds?
SetTwoPhaseDraw(bool twoPhase)In twoPhaseDraw mode, drawing is performed in two phases, first the background and then the foreground. This avoids chopping off characters that overlap the next run.
TargetFromSelectionMake the target range start and end be the same as the selection range start and end.
LinesJoinJoin the lines in the target. This is an experimental feature and may be changed or removed.
LinesSplit(pixelWidth)Split the lines in the target into lines that are less wide than pixelWidth where possible.
SetFoldMarginColour(bool useSetting, color back)Set the colours used as a chequerboard pattern in the fold margin
SetFoldMarginHiColour(bool useSetting, color back)Set the colours used as a chequerboard pattern in the fold margin
LineDownMove caret down one line.
LineDownExtendMove caret down one line extending selection to new caret position.
LineUpMove caret up one line.
LineUpExtendMove caret up one line extending selection to new caret position.
CharLeftMove caret left one character.
CharLeftExtendMove caret left one character extending selection to new caret position.
CharRightMove caret right one character.
CharRightExtendMove caret right one character extending selection to new caret position.
WordLeftMove caret left one word.
WordLeftExtendMove caret left one word extending selection to new caret position.
WordRightMove caret right one word.
WordRightExtendMove caret right one word extending selection to new caret position.
HomeMove caret to first position on line.
HomeExtendMove caret to first position on line extending selection to new caret position.
LineEndMove caret to last position on line.
LineEndExtendMove caret to last position on line extending selection to new caret position.
DocumentStartMove caret to first position in document.
DocumentStartExtendMove caret to first position in document extending selection to new caret position.
DocumentEndMove caret to last position in document.
DocumentEndExtendMove caret to last position in document extending selection to new caret position.
PageUpMove caret one page up.
PageUpExtendMove caret one page up extending selection to new caret position.
PageDownMove caret one page down.
PageDownExtendMove caret one page down extending selection to new caret position.
EditToggleOvertypeSwitch from insert to overtype mode or the reverse.
CancelCancel any modes such as call tip or auto-completion list display.
DeleteBackDelete the selection or if no selection, the character before the caret.
TabIf selection is empty or all on one line replace the selection with a tab character. If more than one line selected, indent the lines.
BackTabDedent the selected lines.
NewLineInsert a new line, may use a CRLF, CR or LF depending on EOL mode.
FormFeedInsert a Form Feed character.
VCHomeMove caret to before first visible character on line. If already there move to first character on line.
VCHomeExtendLike VCHome but extending selection to new caret position.
ZoomInMagnify the displayed text by increasing the sizes by 1 point.
ZoomOutMake the displayed text smaller by decreasing the sizes by 1 point.
DelWordLeftDelete the word to the left of the caret.
DelWordRightDelete the word to the right of the caret.
LineCutCut the line containing the caret.
LineDeleteDelete the line containing the caret.
LineTransposeSwitch the current line with the previous.
LineDuplicateDuplicate the current line.
LowerCaseTransform the selection to lower case.
UpperCaseTransform the selection to upper case.
LineScrollDownScroll the document down, keeping the caret visible.
LineScrollUpScroll the document up, keeping the caret visible.
DeleteBackNotLineDelete the selection or if no selection, the character before the caret. Will not delete the character before at the start of a line.
HomeDisplayMove caret to first position on display line.
HomeDisplayExtendMove caret to first position on display line extending selection to new caret position.
LineEndDisplayMove caret to last position on display line.
LineEndDisplayExtendMove caret to last position on display line extending selection to new caret position.
HomeWrapThese are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? except they behave differently when word-wrap is enabled: They go first to the start / end of the display line, like (Home|LineEnd)Display The difference is that, the cursor is already at the point, it goes on to the start or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
HomeWrapExtendSee HomeWrap
LineEndWrapSee HomeWrap
LineEndWrapExtendSee HomeWrap
VCHomeWrapSee HomeWrap
VCHomeWrapExtendSee HomeWrap
LineCopyCopy the line containing the caret.
MoveCaretInsideViewMove the caret inside current view if it's not there already.
LineLength (line)How many characters are on a line, not including end of line characters?
BraceHighlight (pos1, pos2)Highlight the characters at two positions.
BraceBadLight (pos)Highlight the character at a position indicating there is no matching brace.
BraceMatch (pos)Find the position of a matching brace or INVALID_POSITION if no match.
GetViewEOLAre the end of line characters visible?
SetViewEOL (visible)Make the end of line characters visible or invisible.
GetDocPointerRetrieve a pointer to the document object.
SetDocPointer (pointer)Change the document object used.
SetModEventMask (mask)Set which document modification events are sent to the container.
EDGE constantEDGE_NONE EDGE_LINE EDGE_BACKGROUND
GetEdgeColumnRetrieve the column number which text should be kept within.
SetEdgeColumn (column)Set the column number of the edge. If text goes past the edge then it is highlighted.
GetEdgeModeRetrieve the edge highlight mode.
SetEdgeMode (mode)The edge may be displayed by a line (EDGE_LINE) or by highlighting text that goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
GetEdgeColourRetrieve the colour used in edge indication.
SetEdgeColour (color)Change the colour used in edge indication.
SearchAnchorSets the current caret position to be the search anchor.
SearchNext (flags, text)Find some text starting at the search anchor. Does not ensure the selection is visible.
SearchPrev (flags, text)Find some text starting at the search anchor and moving backwards. Does not ensure the selection is visible.
LinesOnScreenRetrieves the number of lines completely visible.
UsePopUp (allowPopUp)Set whether a pop up menu is displayed automatically when the user presses the wrong mouse button
SelectionIsRectangleIs the selection rectangular? The alternative is the more common stream selection.
SetZoom (zoom)Set the zoom level. This number of points is added to the size of all fonts. It may be positive to magnify or negative to reduce.
GetZoomRetrieve the zoom level.
CreateDocumentCreate a new document object. Starts with reference count of 1 and not selected into editor.
AddRefDocument (doc)Extend life of document.
ReleaseDocument (doc)Release a reference to the document, deleting document if it fades to black.
GetModEventMaskGet which document modification events are sent to the container.
SetFocus (flag)Change internal focus flag.
GetFocusGet internal focus flag.
SetStatusChange error status - 0 = OK.
GetStatusGet error status.
SetMouseDownCaptures (capture)Set whether the mouse is captured when its button is pressed.
GetMouseDownCapturesGet whether mouse gets captured.
CURSOR constantSC_CURSORNORMAL SC_CURSORWAIT
SetCursor (cursorType)Sets the cursor to one of the SC_CURSOR* values.
GetCursorGet cursor type.
SetControlCharSymbol (symbol)Change the way control characters are displayed: If symbol is < 32, keep the drawn way, else, use the given character.
GetControlCharSymbolGet the way control characters are displayed.
WordPartLeftMove to the previous change in capitalisation.
WordPartLeftExtendMove to the previous change in capitalisation extending selection to new caret position.
WordPartRightMove to the change next in capitalisation.
WordPartRightExtendMove to the next change in capitalisation extending selection to new caret position.
VISIBLE constantVISIBLE_SLOP VISIBLE_STRICT
SetVisiblePolicy (visiblePolicy, visibleSlop)Set the way the display area is determined when a particular line is to be moved to by Find, FindNext, GotoLine, etc.
DelLineLeftDelete back from the current position to the start of the line.
DelLineRightDelete forwards from the current position to the end of the line.
SetXOffsetSet the xOffset (ie, horizonal scroll position).
GetXOffsetGet the xOffset (ie, horizonal scroll position).
ChooseCaretXSet the last x chosen value to be the caret x position.
GrabFocusSet the focus to this Scintilla widget.
CARET constantCARET_SLOP If CARET_SLOP is set, we can define a slop value: caretSlop. This value defines an unwanted zone (UZ) where the caret is... unwanted. This zone is defined as a number of pixels near the vertical margins, and as a number of lines near the horizontal margins. By keeping the caret away from the edges, it is seen within its context, so it is likely that the identifier that the caret is on can be completely seen, and that the current line is seen with some of the lines following it which are often dependent on that line. CARET_STRICT If CARET_STRICT is set, the policy is enforced... strictly. The caret is centred on the display if slop is not set, and cannot go in the UZ if slop is set. CARET_JUMPS If CARET_JUMPS is set, the display is moved more energetically so the caret can move in the same direction longer before the policy is applied again. CARET_EVEN If CARET_EVEN is not set, instead of having symmetrical UZs, the left and bottom UZs are extended up to right and top UZs respectively. This way, we favour the displaying of useful information: the begining of lines, where most code reside, and the lines after the caret, eg. the body of a function.
SetXCaretPolicy (caretPolicy, caretSlop)Set the way the caret is kept visible when going sideway. The exclusion zone is given in pixels.
SetYCaretPolicy (caretPolicy, caretSlop)Set the way the line the caret is on is kept visible. The exclusion zone is given in lines.
SetPrintWrapMode (mode)Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
GetPrintWrapModeIs printing line wrapped?
SetHotspotActiveFore (useSetting, color)Set a fore colour for active hotspots.
SetHotspotActiveBack (useSetting, color)Set a back colour for active hotspots.
SetHotspotActiveUnderline (underline)Enable / Disable underlining active hotspots.
SetHotspotSingleLine (singleLine)Limit hotspots to single line so hotspots on two lines don't merge.
ParaDownMove caret between paragraphs (delimited by empty lines).
ParaDownExtendMove caret between paragraphs (delimited by empty lines).
ParaUpMove caret between paragraphs (delimited by empty lines).
ParaUpExtendMove caret between paragraphs (delimited by empty lines).
PositionBefore (pos)Given a valid document position, return the previous position taking code page into account. Returns 0 if passed 0.
PositionAfter(pos)Given a valid document position, return the next position taking code page into account. Maximum value returned is the last position in the document.
CopyRange(start, end)Copy a range of text to the clipboard. Positions are clipped into the document.
CopyText (length, text)Copy argument text to the clipboard.
SetSelectionMode (mode)Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or by lines (SC_SEL_LINES).
GetSelectionModeGet the mode of the current selection.
GetLineSelStartPosition (line)Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
GetLineSelEndPosition (line)Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
LineDownRectExtendMove caret down one line, extending rectangular selection to new caret position.
LineUpRectExtendMove caret up one line, extending rectangular selection to new caret position.
CharLeftRectExtendMove caret left one character, extending rectangular selection to new caret position.
CharRightRectExtendMove caret right one character, extending rectangular selection to new caret position.
HomeRectExtendMove caret to first position on line, extending rectangular selection to new caret position.
VCHomeRectExtendMove caret to before first visible character on line. If already there move to first character on line. In either case, extend rectangular selection to new caret position.
LineEndRectExtendMove caret to last position on line, extending rectangular selection to new caret position.
PageUpRectExtendMove caret one page up, extending rectangular selection to new caret position.
PageDownRectExtendMove caret one page down, extending rectangular selection to new caret position.
StutteredPageUpMove caret to top of page, or one page up if already at top of page.
StutteredPageUpExtendMove caret to top of page, or one page up if already at top of page, extending selection to new caret position.
StutteredPageDownMove caret to bottom of page, or one page down if already at bottom of page.
StutteredPageDownExtendMove caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
WordLeftEndMove caret left one word, position cursor at end of word.
WordLeftEndExtendMove caret left one word, position cursor at end of word, extending selection to new caret position.
WordRightEndMove caret right one word, position cursor at end of word.
WordRightEndExtendMove caret right one word, position cursor at end of word, extending selection to new caret position.
SetWhitespaceChars (characters)Set the set of characters making up whitespace for when moving or selecting by word. Should be called after SetWordChars.
SetCharsDefaultReset the set of characters for whitespace and word characters to the defaults.
AutoCGetCurrentGet currently selected item position in the auto-completion list.
Allocate (bytes)Enlarge the document to a particular size of text bytes.
TargetAsUTF8Returns the target converted to UTF8.
SetLengthForEncode (num_bytes)Set the length of the utf8 argument for calling EncodedFromUTF8. Set to -1 and the string will be measured to the first nul.
EncodedFromUTF8 (utf8string)Translates a UTF8 string into the document encoding. On error returns undef.
FindColumn (line, column)Find the position of a column on a line taking into account tabs and multi-byte characters. If beyond end of line, return line end position.
GetCaretStickyCan the caret preferred x position only be changed by explicit movement commands?
SetCaretSticky (useCaretStickyBehaviour)Stop the caret preferred x position changing when the user types.
ToggleCaretStickySwitch between sticky and non-sticky: meant to be bound to a key.
SetPasteConvertEndings (convert)Enable/Disable convert-on-paste for line endings
GetPasteConvertEndingsGet convert-on-paste setting
SelectionDuplicateDuplicate the selection. If selection empty duplicate the line containing the caret.
SetCaretLineBackAlpha (alpha)Set background alpha of the caret line.
GetCaretLineBackAlphaGet the background alpha of the caret line.
StartRecordStart notifying the container of all key presses and commands.
StopRecordStop notifying the container of all key presses and commands.
SetLexer (lexer)Set the lexing language of the document.
GetLexerRetrieve the lexing language of the document.
Colourise (start, end)Colourise a segment of the document using the current lexing language.
SetProperty (key, value)Set up a value that may be used by a lexer for some optional feature.
GetProperty (key)Retrieve a "property" value previously set with SetProperty.
GetPropertyExpanded (key)Retrieve a "property" value previously set with SetProperty, with "$()" variable replacement on returned buffer.
GetPropertyInt (key)Retrieve a "property" value previously set with SetProperty, interpreted as an int AFTER any "$()" variable replacement.
GetStyleBitsNeededRetrieve the number of bits the current lexer needs for styling.
SetKeyWords (keywordSet, keyWords)Set up the key words used by the lexer.
Maximum value of keywordSet parameter of SetKeyWordsis defined by KEYWORDSET_MAX.
SetLexerLanguage (language)Set the lexing language of the document based on string name.
LoadLexerLibrary (path)Load a lexer library (dll / so).
Lexer constantSee Scintilla.pm
SCLEX_* contant for lexer language. SCE_* for lexer constant.
See comment for relation between Lexer language and lexer constant.
SetCaretPolicy (path)CARET_POLICY changed in 1.47

This module requires these other modules and libraries:
Win32::GUI - L<http://perl-win32-gui.sourceforge.net/> Scintilla - L<http://www.scintilla.org/>


Laurent Rocher (lrocher@cpan.org). Additional Coding: Robert May (robertemay@users.sourceforge.net).

Copyright 2003..2005 by Laurent Rocher (lrocher@cpan.org).
Copyright 2006..2008 by Robert May (robertemay@users.sourceforge.net).
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This program distributes the dynamic link library SciLexer.dll from the Scintilla distribution. Source distributions include header files and interface definitions from the same project. These components come with the following copyright and licence:
Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>. All Rights Reserved.
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.