wxStyledTextCtrl

wxStyledTextCtrl

wxStyledTextCtrl
Functions for wxStyledTextCtrl class

A wxWidgets implementation of the Scintilla source code editing component.

As well as features found in standard text editing components, Scintilla includes features especially useful when editing and debugging source code. These include support for syntax styling, error indicators, code completion and call tips.

The selection margin can contain markers like those used in debuggers to indicate breakpoints and the current line. Styling choices are more open than with many editors, allowing the use of proportional fonts, bold and italics, multiple foreground and background colours and multiple fonts.

wxStyledTextCtrl is a 1 to 1 mapping of "raw" scintilla interface, whose documentation can be found in the Scintilla website (http://www.scintilla.org/).

Please see wxStyledTextEvent for the documentation of all event types you can use with wxStyledTextCtrl.

Index of the member groups

Links for quick access to the various categories of wxStyledTextCtrl functions:

See: wxStyledTextEvent

This class is derived (and can use functions) from: wxControl wxWindow wxEvtHandler

wxWidgets docs: wxStyledTextCtrl

Types

Set all style bytes to 0, remove all folding information.

Types

Redoes the next action on the undo history.

Types

CollectUndo = boolean()

Choose between collecting actions into the undo history and discarding them.

Types

Select all the text in the document.

Types

Remember the current position in the undo history as the position at which the document was saved.

Types

Are white space characters currently visible? Returns one of wxSTC_WS_* constants.

Types

ViewWS = integer()

Make white space characters invisible, always visible or visible outside indentation.

The input should be one of the ?wxSTC_WS_* constants.

Types

X = Y = integer()

Find the position from a point within the window but return wxSTC_INVALID_POSITION if not close to text.

Types

Anchor = integer()

Set the selection anchor to a position.

The anchor is the opposite end of the selection from the caret.

Types

Result = {Res :: unicode:charlist(), LinePos :: integer()}

Retrieve the text of the line containing the caret.

linePos can optionally be passed in to receive the index of the caret on the line.

Types

EolMode = integer()

Convert all line endings in the document to one mode.

Types

Retrieve the current end of line mode - one of wxSTC_EOL_CRLF, wxSTC_EOL_CR, or wxSTC_EOL_LF.

Types

EolMode = integer()

Set the current end of line mode.

The input should be one of the ?wxSTC_EOL_* constants.

Types

Length = Style = integer()

Change style from current styling position for length characters to a style and move the current styling position to after this newly styled segment.

Types

Buffered = boolean()

If drawing is buffered then each line of text is drawn into a bitmap buffer before drawing it to the screen to avoid flicker.

Types

TabWidth = integer()

Change the visible size of a tab to be a multiple of the width of a space character.

Types

CodePage = integer()

Set the code page used to interpret the bytes of the document as characters.

Types

MarkerNumber = MarkerSymbol = integer()
Option =
    {foreground, wx:wx_colour()} | {background, wx:wx_colour()}

Set the symbol used for a particular marker number, and optionally the fore and background colours.

The second argument should be one of the ?wxSTC_MARK_* constants.

Types

Line = MarkerNumber = integer()

Add a marker to a line, returning an ID which can be used to find or delete the marker.

Types

Line = MarkerNumber = integer()

Delete a marker from a line.

Types

MarkerNumber = integer()

Delete all markers with a particular number from all lines.

Types

LineStart = MarkerMask = integer()

Find the next line at or after lineStart that includes a marker in mask.

Return -1 when no more lines.

Types

LineStart = MarkerMask = integer()

Find the previous line before lineStart that includes a marker in mask.

Types

Line = MarkerSet = integer()

Add a set of markers to a line.

Types

MarkerNumber = Alpha = integer()

Set the alpha used for a marker that is drawn in the text area, not the margin.

Types

Margin = MarginType = integer()

Set a margin to be either numeric or symbolic.

The second argument should be one of the ?wxSTC_MARGIN_* constants.

Types

Margin = integer()

Retrieve the type of a margin.

The return value will be one of the ?wxSTC_MARGIN_* constants.

Types

Margin = PixelWidth = integer()

Set the width of a margin to a width expressed in pixels.

Types

Margin = Mask = integer()

Set a mask that determines which markers are displayed in a margin.

Types

Margin = integer()
Sensitive = boolean()

Make a margin sensitive or insensitive to mouse clicks.

Types

Clear all the styles and make equivalent to the global default style.

Types

Style = SizePoints = integer()

Set the size of characters of a style.

Types

Reset the default style to its state at startup.

Types

Style = CaseVisible = integer()

Set a style to be mixed case, or to force upper or lower case.

The second argument should be one of the ?wxSTC_CASE_* constants.

Types

UseSetting = boolean()

Set the foreground colour of the main and additional selections and whether to use this setting.

Types

UseSetting = boolean()

Set the background colour of the main and additional selections and whether to use this setting.

Types

Key = Modifiers = Cmd = integer()

When key+modifier combination keyDefinition is pressed perform sciCommand.

The second argument should be a bit list containing one or more of the ?wxSTC_KEYMOD_* constants and the third argument should be one of the ?wxSTC_CMD_* constants.

Types

Key = Modifiers = integer()

When key+modifier combination keyDefinition is pressed do nothing.

The second argument should be a bit list containing one or more of the ?wxSTC_KEYMOD_* constants.

Types

PeriodMilliseconds = integer()

Get the time in milliseconds that the caret is on and off.

0 = steady on.

Types

Characters = unicode:chardata()

Set the set of characters making up words for when moving or selecting by word.

First sets defaults like SetCharsDefault.

Types

Start a sequence of actions that is undone and redone as a unit.

May be nested.

Types

End a sequence of actions that is undone and redone as a unit.

Types

Indicator = IndicatorStyle = integer()

Set an indicator to plain, squiggle or TT.

The second argument should be one of the ?wxSTC_INDIC_* constants.

Types

Indicator = integer()

Retrieve the style of an indicator.

The return value will be one of the ?wxSTC_INDIC_* constants.

Types

UseSetting = boolean()

Set the foreground colour of all whitespace and whether to use this setting.

Types

UseSetting = boolean()

Set the background colour of all whitespace and whether to use this setting.

Types

Retrieve number of bits in style bytes used to hold the lexical state.

Deprecated:

Types

Line = State = integer()

Used to hold extra styling information for each line.

Types

Is the background of the line containing the caret in a different colour?

Types

Show = boolean()

Display the background of the line containing the caret in a different colour.

Types

Set the colour of the background of the line containing the caret.

Types

LengthEntered = integer()

Display a auto-completion list.

The lengthEntered parameter indicates how many characters before the caret should be used to provide context.

Types

Remove the auto-completion list from the screen.

Types

Retrieve the position of the caret when the auto-completion list was displayed.

Types

User has selected an item so remove the list and insert the selection.

Types

CharacterSet = unicode:chardata()

Define a set of character that when typed cancel the auto-completion list.

Types

SeparatorCharacter = integer()

Change the separator character in the string setting up an auto-completion list.

Default is space but can be changed if items contain space.

Types

Cancel = boolean()

Should the auto-completion list be cancelled if the user backspaces to a position before where the box was created.

Types

Retrieve whether auto-completion cancelled by backspacing before start.

Types

CharacterSet = unicode:chardata()

Define a set of characters that when typed will cause the autocompletion to choose the selected item.

Types

ChooseSingle = boolean()

Should a single item auto-completion list automatically choose the item.

Types

Retrieve whether a single item auto-completion list automatically choose the item.

Types

IgnoreCase = boolean()

Set whether case is significant when performing auto-completion searches.

Types

AutoHide = boolean()

Set whether or not autocompletion is hidden automatically when nothing matches.

Types

Retrieve whether or not autocompletion is hidden automatically when nothing matches.

Types

DropRestOfWord = boolean()

Set whether or not autocompletion deletes any word characters after the inserted text upon completion.

Types

Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion.

Types

Clear all the registered images.

Types

Retrieve the auto-completion list type-separator character.

Types

SeparatorCharacter = integer()

Change the type-separator character in the string setting up an auto-completion list.

Default is '?' but can be changed if items contain '?'.

Types

CharacterCount = integer()

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.

Types

Get the maximum width, in characters, of auto-completion and user lists.

Types

RowCount = integer()

Set the maximum height, in rows, of auto-completion and user lists.

The default is 5 rows.

Types

Set the maximum height, in rows, of auto-completion and user lists.

Types

IndentSize = integer()

Set the number of spaces used for one level of indentation.

Types

UseTabs = boolean()

Indentation will only use space characters if useTabs is false, otherwise it will use a combination of tabs and spaces.

Types

Line = Indentation = integer()

Change the indentation of a line to a number of columns.

Types

Visible = boolean()

Show or hide the horizontal scroll bar.

Types

IndentView = integer()

Show or hide indentation guides.

The input should be one of the ?wxSTC_IV_* constants.

Types

Are the indentation guides visible?

The return value will be one of the ?wxSTC_IV_* constants.

Types

Column = integer()

Set the highlighted indentation guide column.

0 = no highlighted guide.

Types

Get the code page used to interpret the bytes of the document as characters.

Types

Anchor = integer()

Sets the position that starts the selection - this becomes the anchor.

Types

Caret = integer()

Sets the position that ends the selection - this becomes the caret.

Types

Magnification = integer()

Sets the print magnification added to the point size of each style for printing.

Types

Mode = integer()

Modify colours when printing for clearer printed text.

The input should be one of the ?wxSTC_PRINT_* constants.

Types

Returns the print colour mode.

The return value will be one of the ?wxSTC_PRINT_* constants.

Types

MinPos = MaxPos = integer()
Option = {flags, integer()}

Find some text in the document. @param minPos The position (starting from zero) in the document at which to begin the search @param maxPos The last position (starting from zero) in the document to which the search will be restricted. @param text The text to search for. @param flags (Optional) The search flags. This should be a bit list containing one or more of the @link wxStyledTextCtrl::wxSTC_FIND_WHOLEWORD wxSTC_FIND_* @endlink constants.

Return: The position (starting from zero) in the document at which the text was found or wxSTC_INVALID_POSITION if the search fails.

Remark: A backwards search can be performed by setting minPos to be greater than maxPos.

Types

DoDraw = boolean()
StartPos = EndPos = integer()
Draw = Target = wxDC:wxDC()
RenderRect = PageRect =
    {X :: integer(),
     Y :: integer(),
     W :: integer(),
     H :: integer()}

On Windows, will draw the document into a display context such as a printer.

Types

Returns the number of lines in the document.

There is always at least one.

Types

PixelWidth = integer()

Sets the size in pixels of the left margin.

Types

PixelWidth = integer()

Sets the size in pixels of the right margin.

Types

From = To = integer()

Selects the text starting at the first position up to (but not including) the character at the last position.

If both parameters are equal to -1 all text in the control is selected.

Notice that the insertion point will be moved to from by this function.

See: selectAll/1

Types

Hide = boolean()

Draw the selection in normal style or with selection highlighted.

Types

Columns = Lines = integer()

Scroll horizontally and vertically.

Types

Ensure the caret is visible.

Types

Paste the contents of the clipboard into the document replacing the selection.

Types

Start = integer()

Sets the position that starts the target which is used for updating the document without affecting the scroll position.

Types

End = integer()

Sets the position that ends the target which is used for updating the document without affecting the scroll position.

Replace the target text with the argument text.

Text is counted so it can contain NULs. Returns the length of the replacement 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.

Types

SearchFlags = integer()

Set the search flags used by SearchInTarget.

The input should be a bit list containing one or more of the ?wxSTC_FIND_* constants.

Types

Get the search flags used by SearchInTarget.

The return value will be a bit list containing one or more of the ?wxSTC_FIND_* constants.

Types

Remove the call tip from the screen.

Types

Retrieve the position where the caret was before displaying the call tip.

Since: 3.1.0

Types

HighlightStart = HighlightEnd = integer()

Highlight a segment of the definition.

Types

Set the foreground colour for the highlighted part of the call tip.

Types

TabSize = integer()

Enable use of wxSTC_STYLE_CALLTIP and set call tip tab size in pixels.

Types

DisplayLine = integer()

Find the document line of a display line taking hidden lines into account.

Types

Line = Level = integer()

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.

Types

LineStart = LineEnd = integer()

Make a range of lines visible.

Types

LineStart = LineEnd = integer()

Make a range of lines invisible.

Types

Line = integer()

Ensure a particular line is visible by expanding any header line hiding it.

Types

Flags = integer()

Set some style options for folding.

The second argument should be a bit list containing one or more of the ?wxSTC_FOLDFLAG_* constants.

Types

Line = integer()

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.

Types

TabIndents = boolean()

Sets whether a tab pressed when caret is within indentation indents.

Types

BsUnIndents = boolean()

Sets whether a backspace pressed when caret is within indentation unindents.

Types

Does a backspace pressed when caret is within indentation unindent?

Types

PeriodMilliseconds = integer()

Sets the time the mouse must sit still to generate a mouse dwell event.

The input should be a time in milliseconds or wxSTC_TIME_FOREVER.

Types

Retrieve the time the mouse must sit still to generate a mouse dwell event.

The return value will be a time in milliseconds or wxSTC_TIME_FOREVER.

Types

WrapMode = integer()

Sets whether text is word wrapped.

The input should be one of the ?wxSTC_WRAP_* constants.

Types

Retrieve whether text is word wrapped.

The return value will be one of the ?wxSTC_WRAP_* constants.

Types

WrapVisualFlags = integer()

Set the display mode of visual flags for wrapped lines.

The input should be a bit list containing one or more of the ?wxSTC_WRAPVISUALFLAG_* constants.

Types

Retrieve the display mode of visual flags for wrapped lines.

The return value will be a bit list containing one or more of the ?wxSTC_WRAPVISUALFLAG_* constants.

Types

WrapVisualFlagsLocation = integer()

Set the location of visual flags for wrapped lines.

The input should be a bit list containing one or more of the ?wxSTC_WRAPVISUALFLAGLOC_* constants.

Types

Retrieve the location of visual flags for wrapped lines.

The return value will be a bit list containing one or more of the ?wxSTC_WRAPVISUALFLAGLOC_* constants.

Types

CacheMode = integer()

Sets the degree of caching of layout information.

The input should be one of the ?wxSTC_CACHE_* constants.

Types

Retrieve the degree of caching of layout information.

The return value will be one of the ?wxSTC_CACHE_* constants.

Types

PixelWidth = integer()

Sets the document width assumed for scrolling.

Types

Retrieve whether the maximum scroll position has the last line at the bottom of the view.

Types

Visible = boolean()

Show or hide the vertical scroll bar.

Types

Is drawing done in two phases with backgrounds drawn before foregrounds?

Types

TwoPhase = boolean()

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.

Types

Make the target range start and end be the same as the selection range start and end.

Types

PixelWidth = integer()

Split the lines in the target into lines that are less wide than pixelWidth where possible.

Types

Move caret down one line extending selection to new caret position.

Types

Move caret up one line extending selection to new caret position.

Types

Move caret left one character extending selection to new caret position.

Types

Move caret right one character extending selection to new caret position.

Types

Move caret left one word extending selection to new caret position.

Types

Move caret right one word extending selection to new caret position.

Types

Move caret to first position on line extending selection to new caret position.

Types

Move caret to last position on line.

Types

Move caret to last position on line extending selection to new caret position.

Types

Move caret to first position in document.

Types

Move caret to first position in document extending selection to new caret position.

Types

Move caret to last position in document.

Types

Move caret to last position in document extending selection to new caret position.

Types

Move caret one page up extending selection to new caret position.

Types

Move caret one page down extending selection to new caret position.

Types

Switch from insert to overtype mode or the reverse.

Types

Cancel any modes such as call tip or auto-completion list display.

Types

Delete the selection or if no selection, the character before the caret.

Types

If selection is empty or all on one line replace the selection with a tab character.

If more than one line selected, indent the lines.

Types

Insert a new line, may use a CRLF, CR or LF depending on EOL mode.

Types

Move caret to before first visible character on line.

If already there move to first character on line.

Types

Like VCHome but extending selection to new caret position.

Types

Magnify the displayed text by increasing the sizes by 1 point.

Types

Make the displayed text smaller by decreasing the sizes by 1 point.

Types

Delete the word to the left of the caret.

Types

Delete the word to the right of the caret.

Types

Delete the line containing the caret.

Types

Switch the current line with the previous.

Types

Transform the selection to lower case.

Types

Transform the selection to upper case.

Types

Scroll the document down, keeping the caret visible.

Types

Scroll the document up, keeping the caret visible.

Types

Delete the selection or if no selection, the character before the caret.

Will not delete the character before at the start of a line.

Types

Move caret to first position on display line.

Types

Move caret to first position on display line extending selection to new caret position.

Types

Move caret to last position on display line.

Types

Move caret to last position on display line extending selection to new caret position.

Types

Like HomeExtend but when word-wrap is enabled extends first to start of display line HomeDisplayExtend, then to start of document line HomeExtend.

Types

Like LineEnd but when word-wrap is enabled goes first to end of display line LineEndDisplay, then to start of document line LineEnd.

Types

Like LineEndExtend but when word-wrap is enabled extends first to end of display line LineEndDisplayExtend, then to start of document line LineEndExtend.

Types

Like VCHome but when word-wrap is enabled goes first to start of display line VCHomeDisplay, then behaves like VCHome.

Types

Like VCHomeExtend but when word-wrap is enabled extends first to start of display line VCHomeDisplayExtend, then behaves like VCHomeExtend.

Types

Copy the line containing the caret.

Types

Move the caret inside current view if it's not there already.

Types

PosA = PosB = integer()

Highlight the characters at two positions.

Types

Pos = integer()

Highlight the character at a position indicating there is no matching brace.

Types

Visible = boolean()

Make the end of line characters visible or invisible.

Types

EventMask = integer()

Set which document modification events are sent to the container.

The input should be a bit list containing one or more of the ?wxSTC_MOD_* constants, the ?wxSTC_PERFORMED_* constants, wxSTC_STARTACTION, wxSTC_MULTILINEUNDOREDO, wxSTC_MULTISTEPUNDOREDO, and wxSTC_LASTSTEPINUNDOREDO. The input can also be wxSTC_MODEVENTMASKALL to indicate that all changes should generate events.

Types

Column = integer()

Set the column number of the edge.

If text goes past the edge then it is highlighted.

Types

EdgeMode = integer()

The edge may be displayed by a line (wxSTC_EDGE_LINE/wxSTC_EDGE_MULTILINE) or by highlighting text that goes beyond it (wxSTC_EDGE_BACKGROUND) or not displayed at all (wxSTC_EDGE_NONE).

The input should be one of the ?wxSTC_EDGE_* constants.

Types

Retrieve the edge highlight mode.

The return value will be one of the ?wxSTC_EDGE_* constants.

Types

Sets the current caret position to be the search anchor.

Types

PopUpMode = integer()

Set whether a pop up menu is displayed automatically when the user presses the wrong mouse button on certain areas.

The input should be one of the ?wxSTC_POPUP_* constants.

Remark: When wxContextMenuEvent is used to create a custom popup menu, this function should be called with wxSTC_POPUP_NEVER. Otherwise the default menu will be shown instead of the custom one.

Types

Is the selection rectangular? The alternative is the more common stream selection.

Types

ZoomInPoints = integer()

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.

Types

Get which document modification events are sent to the container.

The return value will wxSTC_MODEVENTMASKALL if all changes generate events. Otherwise it will be a bit list containing one or more of the ?wxSTC_MOD_* constants, the ?wxSTC_PERFORMED_* constants, wxSTC_STARTACTION, wxSTC_MULTILINEUNDOREDO, wxSTC_MULTISTEPUNDOREDO, and wxSTC_LASTSTEPINUNDOREDO.

Types

Status = integer()

Change error status - 0 = OK.

The input should be one of the ?wxSTC_STATUS_* constants.

Types

Get error status.

The return value will be one of the ?wxSTC_STATUS_* constants.

Types

Captures = boolean()

Set whether the mouse is captured when its button is pressed.

Types

CursorType = integer()

Sets the cursor to one of the wxSTC_CURSOR* values.

Types

Get cursor type.

The return value will be one of the ?wxSTC_CURSOR* constants.

Types

Symbol = integer()

Change the way control characters are displayed: If symbol is < 32, keep the drawn way, else, use the given character.

Types

Move to the previous change in capitalisation.

Types

Move to the previous change in capitalisation extending selection to new caret position.

Types

Move to the change next in capitalisation.

Types

Move to the next change in capitalisation extending selection to new caret position.

Types

VisiblePolicy = VisibleSlop = integer()

Set the way the display area is determined when a particular line is to be moved to by Find, FindNext, GotoLine, etc.

The first argument should be a bit list containing one or more of the ?wxSTC_VISIBLE_* constants.

Types

Delete back from the current position to the start of the line.

Types

Delete forwards from the current position to the end of the line.

Types

Set the last x chosen value to be the caret x position.

Types

CaretPolicy = CaretSlop = integer()

Set the way the caret is kept visible when going sideways.

The exclusion zone is given in pixels.

The first argument should be a bit list containing one or more of the ?wxSTC_CARET_* constants.

Types

CaretPolicy = CaretSlop = integer()

Set the way the line the caret is on is kept visible.

The exclusion zone is given in lines.

The first argument should be a bit list containing one or more of the ?wxSTC_CARET_* constants.

Types

Is printing line wrapped?

The return value will be one of the ?wxSTC_WRAP_* constants.

Types

Underline = boolean()

Enable / Disable underlining active hotspots.

Types

SingleLine = boolean()

Limit hotspots to single line so hotspots on two lines don't merge.

Types

Extend selection down one paragraph (delimited by empty lines).

Types

Move caret up one paragraph (delimited by empty lines).

Types

Extend selection up one paragraph (delimited by empty lines).

Types

Pos = integer()

Given a valid document position, return the previous position taking code page into account.

Returns 0 if passed 0.

Types

Pos = integer()

Given a valid document position, return the next position taking code page into account.

Maximum value returned is the last position in the document.

Types

Start = End = integer()

Copy a range of text to the clipboard.

Positions are clipped into the document.

Types

SelectionMode = integer()

Set the selection mode to stream (wxSTC_SEL_STREAM) or rectangular (wxSTC_SEL_RECTANGLE/wxSTC_SEL_THIN) or by lines (wxSTC_SEL_LINES).

Types

Get the mode of the current selection.

The return value will be one of the ?wxSTC_SEL_* constants.

Types

Move caret down one line, extending rectangular selection to new caret position.

Types

Move caret up one line, extending rectangular selection to new caret position.

Types

Move caret left one character, extending rectangular selection to new caret position.

Types

Move caret right one character, extending rectangular selection to new caret position.

Types

Move caret to first position on line, extending rectangular selection to new caret position.

Types

Move 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.

Types

Move caret to last position on line, extending rectangular selection to new caret position.

Types

Move caret one page up, extending rectangular selection to new caret position.

Types

Move caret one page down, extending rectangular selection to new caret position.

Types

Move caret to top of page, or one page up if already at top of page.

Types

Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.

Types

Move caret to bottom of page, or one page down if already at bottom of page.

Types

Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.

Types

Move caret left one word, position cursor at end of word.

Types

Move caret left one word, position cursor at end of word, extending selection to new caret position.

Types

Move caret right one word, position cursor at end of word.

Types

Move caret right one word, position cursor at end of word, extending selection to new caret position.

Types

Characters = unicode:chardata()

Set the set of characters making up whitespace for when moving or selecting by word.

Should be called after SetWordChars.

Types

Reset the set of characters for whitespace and word characters to the defaults.

Types

Get currently selected item position in the auto-completion list.