#TextEditor
UserControl
C
_Properties
C
s
"*,Border=True,ShowPreview,ScrollBar{Scroll.*}=Both,Highlight{None;Custom;C;CPlusPlus;CSS;Diff;Gambas;HTML;JavaScript;SQL;WebPage;Sh}=None,Mode{None;Custom;C;CPlusPlus;CSS;Diff;Gambas;HTML;JavaScript;SQL;WebPage;Sh}=None,ReadOnly,TabSize{Range:2;64}=2,TabIndent,Wrap,ShowPosition,ShowLimit,ShowCurrent,ShowLineNumber,ShowModified,ShowBraces,ShowIcon,ShowExpand,ShowCursor=True,ShowSpaces,ShowIndent,CloseBraces,CloseStrings"
_DrawWith
C
s
"-"
_DefaultEvent
C
s
"Change"
_Similar
C
s
"TextArea"
_Group
C
s
"View"
:Cursor
:


'This event is raised when the cursor has moved.
:Scroll
:


'This event is raised when the editor has scrolled.
:Change
:


'This event is raised when the editor contents has changed.
:Margin
:


'This event is raised when the user has clicked twice inside the margin.
'
'The cursor has been moved to the clicked line before raising the event.
:Highlight
:

(Text)s
'This event is raised when a text line must be highlighted.
'
'- ~Text~ if the text to highlight.
'
'This event is only raised when the [../highlight] property is set to `"custom"`, `"none"` or a null string.
Text
p
s

'Return or set the editor contents.
Count
r
i

'Return the number of lines.
Max
r
i

'Return the number of lines minus one.
Line
r
i

'Return the current line position, starting from zero.
Column
r
i

'Return the current column position, starting from zero.
SelectionLine
r
i

'Return the line position of the selection mark.
'
'If no text is selected, the same value as [../line] is returned.
SelectionColumn
r
i

'Return the column position of the selection mark.
'
'If no text is selected, the same value as [../column] is returned.
LastLine
r
i

'Return the old line position before a cursor move.
'
'This property is only meaningful during a [../.change] event handler.
LastColumn
r
i

'Return the old column position before a cursor move.
'
'This property is only meaningful during a [../.change] event handler.
Selected
r
b

'Return if some text is selected.
SelectedText
r
s

'Return the selected text if any.
ReadOnly
p
b

'Return or set if the editor is in read-only mode.
ShowPreview
p
b

'Return or set if the editor right scrollbar is replaced by a preview.
Mode
p
s

'Return or set the editor mode.
'
'The editor mode tells how the text is highlighted, and how the editor behaves.
'
'The property can take the same values as the [../highlight] property.
'
'If the editor mode is 'NULL', then there is no custom editor behaviour, and the text is highlighted only if the [../highlight] property is set.
Highlight
p
s

'Return or set the highlighting mode.
'
'It can take one of the following values: `"c"`, `"c++"` or `"cplusplus"`, `"css"`, `"custom"`, `"diff"`, `"gambas"`, `"html"`, `"none"`, `"javascript"`, `"sh"`, `"sql"`, `"webpage"`.
'
'If the highlighting mode is set to `"custom"`, `"none"` or a null string, then the [../.highlight] event will be raised each time a line must be highlighted.
'If you do not implement the handler for that event, nothing will be highlighted.
'
'The property is 'NULL' by default.
LineNumberOffset
p
i

'Return or set the line number offset.
'
'The value of this property will be added to actual line number for displaying.
TabSize
p
i

'Return or set the tab size.
'
'It is the number of spaces used for indenting.
TabIndent
p
b

'Return or set if the ident is made of tab characters.
'
'If this property is 'TRUE', each indentation uses one `"\t"` character.
'If this property is 'FALSE', each indentation uses the number of space characters defined by the [../tabsize] property.
Length
r
i

'Return the length of the editor contents.
'
'It is the number of UTF-8 characters, not the number of bytes.
Border
p
b

'Return or set if a border must be drawn around the editor.
ScrollBar
p
i

'--> /comp/gb.qt4/scrollview/scrollbar
Overwrite
p
b

'Return or set if the editor is in overwrite mode.
LineHeight
r
i

'Return the height of a line in pixels.
Current
r
_TextEditor_Line

'Return the current line as a virtual object.
Font
p
Font

'--> /comp/gb.qt4/control/font
StopLine
p
i

'Return or set the debugger stop line.
EndOfLine
p
i

'Return or set the newline separator used by the editor.
'
'The possible values are:
'* [gb.Unix] (../../gb/unix) for lines separated by '[/lang/chr]\(10)'.
'* [gb.Windows] (../../gb/windows) for lines separated by '[/lang/chr]\(13) & [/lang/chr]\(10)'.
'* [gb.Mac] (../../gb/mac)  for lines separated by '[/lang/chr]\(13)'. 
Breakpoints
p
Integer[]

'Return or set the list of lines having a breakpoint
DisabledBreakpoints
p
Integer[]

'Return or set the list of lines having a disabled breakpoint
Bookmarks
p
Integer[]

'Return or set the list of lines having a bookmark
Styles
r
TextHighlighterStyle[]

'Return a virtual object that allows to define the editor highlighting style.
'
'@{since 3.17}
'This property is now deprecated. Use the [../theme] property instead.
View
p
TextEditor

'Return or set the main view of a editor.
'
'This property allows different editors to share the same contents.
'
'- If this property is 'NULL' (the default), then the editor has its own contents.
'- Otherwise, the editor uses the contents of its view.
Keywords
r
String[]

'Return the language keywords associated with the editor mode, as defined by the [../mode] property.
Wrap
p
b

'Return or set if the editor wraps its contents.
DiffMode
r
b

'Return or set if the "diff mode" is activated.
'
'When the "diff mode" is activated, the editor becomes read-only, and displays each added or removed text defined
'by the [../enterdiffmode] method.
ScrollX
p
i

'--> /comp/gb.qt4/scrollview/scrollx
ScrollY
p
i

'--> /comp/gb.qt4/scrollview/scrolly
ScrollWidth
r
i

'--> /comp/gb.qt4/scrollview/scrollwidth
ScrollW
r
i

'--> /comp/gb.qt4/scrollview/scrollwidth
ScrollHeight
r
i

'--> /comp/gb.qt4/scrollview/scrollheight
ScrollH
r
i

'--> /comp/gb.qt4/scrollview/scrollheight
ShowLimit
p
b

'Return or set if the function limits are visible.
ShowCurrent
p
b

'Return or set if the current line is highlighted.
ShowLineNumber
p
b

'Return or set if the line numbers are displayed.
ShowModified
p
b

'Return or set if the modified lines are highlighted in the margin.
ShowPosition
p
b

'Return or set if the cursor current position is displayed.
ShowIcon
p
b

'Return or set if the breakpoint or bookmark icons are visible.
ShowBraces
p
b

'Return or set if matching braces are highlighted.
ShowCursor
p
b

'Return or set if the cursor is visible.
ShowExpand
p
b

'Return or set if the functions can be collapsed and expanded.
ShowSpaces
p
b

'Return or set if trailing whitespaces are displayed as dots.
ShowIndent
p
b

'Return or set if indentation is highlighted with vertical lines.
CloseBraces
p
b

'Return or set if braces are automatically closed.
CloseStrings
p
b

'Return or set if strings are automatically closed.
Theme
p
TextHighlighterTheme

'Return or set the theme used for highlighting. Replace the [../styles] property.
_Views
v
TextEditor[]

_TopHeight
v
i

_new
m


'Create a new TextEditor
_SetDocument
m

(hDoc)CDocument;
Copy
m


'Copy the current selected text to the clipboard.
'
'If no text is selected, nothing is done.
_ClearCachePos
m

[(Y)i]
Refresh
m


'Refresh the editor view.
Clear
m


'Clear the editor contents
Goto
m

(NX)i(NY)i[(Mark)b]
'Move the cursor to the specified position.
'
'- ~NX~ and ~NY~ are respectively the column and the line of the new position.
'- If ~Mark~ is 'TRUE', then the text between the old position and the new position is selected.
Scroll
m

(X)i(Y)i
'--> /comp/gb.qt4/scrollview/scroll
Load
m

(Path)s[(AddNewLine)b]
'Load a file into the editor.
'
'- ~Path~ is the path of the file to load.
'- If ~AddNewLine~ is 'TRUE', then a newline will be added to the end of the file if there is not.
Save
m

(Path)s
'Save the editor contents into a file.
'
'- ~Path~ is the path of the file to write.
_UpdateAllHeight
m

[(bNow)b]
View_Font
m


Begin
m


'Start a serie of changes that will be undone in one shot.
'
'## See also
'- [../end]
End
m


'End a serie of changes.
'
'## See also
'- [../begin]
Remove
m

(X1)i(Y1)i(X2)i(Y2)i[(bRight)b]
'Remove the text located between two cursor positions.
'
'- ~X1~ and ~Y1~ are the column and row of the first position.
'- ~X2~ and ~Y2~ are the column and row of the other position.
'- Set ~Right~ to 'TRUE' if the cursor was at the beginning of the selection.
_PaintRow
m

(Row)i(X)i(Y)i
_ViewToReal
m
i
(Y)i
_RealToView
m
i
(Y)i
_IsRowExpanded
m
b
(Y)i
_ResizeContents
m


TimerCursor_Timer
m


_RefreshLine
m

(Y)i[(N)i]
View_KeyPress
m


Paste
m


'Paste the contents of the clipboard inside the editor.
Undo
m


'Undo the last change.
Redo
m


'Redo the last undone change.
Cut
m


'Cut the current selected text and copy it to the clipboard.
'
'If no text is selected, the entire editor contents is cut.
SelectAll
m


'Select all editor contents
ShowFindPanel
m


'Display the text search panel.
ShowGotoPanel
m


'Display the goto line panel.
Insert
m

(Text)s
'Insert some text at the current cursor position.
'
'- ~Text~ is the text to insert.
'
'The text can be multi-line. The line separator is always `"\n"` in that case.
FindPreviousDiff
m
i
(Y)i
'Find the line position of the previous difference.
'
'- ~Y~ is the line position where the search starts.
'
'If no difference is found, '-1' is returned.
FindPreviousLimit
m
i
(Y)i
'Find the line position of the previous function limit.
'
'- ~Y~ is the line position where the search starts.
'
'If no limit is found, '-1' is returned.
FindNextDiff
m
i
(Y)i
'Find the line position of the next difference.
'
'- ~Y~ is the line position where the search starts.
'
'If no difference is found, '-1' is returned.
FindNextLimit
m
i
(Y)i
'Find the line position of the next function limit.
'
'- ~Y~ is the line position where the search starts.
'
'If no limit is found, '-1' is returned.
CollapseAll
m


'Collapse all functions
ExpandAll
m


'Expand all functions.
HideSelection
m


'Hide the current selection if any.
_RaiseCursor
m


TimerChange_Timer
m


_GetRowHeight
m
i
(Y)i
GotoCenter
m

(NX)i(NY)i
'Move the cursor to the specified position and center the view around it.
'
'- ~NX~ and ~NY~ are respectively the column and the line of the new position.
EnsureVisible_Timer
m


View_MouseDown
m


View_DblClick
m


View_MouseDrag
m


View_MouseMove
m


View_MouseUp
m


TimerScroll_Timer
m


Append
m

(Text)s
'Append some text to the editor's end without moving the cursor.
'
'- ~Text~ is the text that will be inserted at the end of the editor contents.
'
'The text can be multi-line. The line separator is always `"\n"` in that case.
_BeforeInsert
m

(Y1)i(N)i
_AfterInsert
m

(Y1)i(Y2)i(N)i
_AfterRemove
m

(Y1)i(Y2)i
View_Draw
m


View_Resize
m


_get
m
_TextEditor_Line
(Line)i
'Return a virtual object representing a specific line.
'
'- ~Line~ is the line number of the returned object.
View_Scroll
m


_RaiseChange
m


View_Arrange
m


Select
m

(Column)i(Line)i(Column2)i(Line2)i
'Select a specific text range.
'
'- ~Column~ and ~Line~ define the starting column and line of the text range.
'- ~Column2~ and ~Line2~ define the ending column and line of the text range.
_RemoveView
m

(hOther)TextEditor;
_AddView
m

(hOther)TextEditor;
_GetDocument
m
CDocument

_EnterDiffMode
m


View_GotFocus
m


View_LostFocus
m


_GetViews
m
TextEditor[]

ToPosX
m
i
[(Column)i(Line)i]
'Return the relative horizontal position in pixels of a specific cursor position.
'
'- ~Column~ and ~Line~ are the column and line position. If omitted, the current cursor position is used.
ToPosY
m
i
[(Line)i]
'Return the relative vertical position in pixels of a specific cursor position.
'
'- ~Line~ is the line position. If omitted, the current cursor position is used.
ToPos
m
Point
[(Line)i(Column)i]
'Return the relative position in pixels of a specific cursor position.
'
'- ~Column~ and ~Line~ are the column and line position. If omitted, the current cursor position is used.
CursorAt
m
Point
[(Line)i(Column)i]
'Convert a cursor position into pixel position
'
'- ~Line~ and ~Column~ define the cursor position. If omitted, they are replaced by the cursor position.
'
'This method returns the position in pixels as a [/comp/gb.qt4/point] object.
ToColumn
m
i
(X)i(Y)i
'Return the column located under the specified mouse cursor position.
'
'- ~X~ and ~Y~ are the position of the mouse cursor relative to the TextEditor control.
ToLine
m
i
(Y)i
'Return the line located under the specified mouse cursor position.
'
'- ~Y~ is the vertical position of the mouse cursor relative to the TextEditor control.
Indent
m


'Indent the selected text, or the current line if there is no selected text.
Unindent
m


'Unindent the selected text, or the current line if there is no selected text.
UpperCase
m


'Convert the selected text to upper case.
'
'If no text is selected, that method does nothing.
LowerCase
m


'Convert the selected text to lower case.
'
'If no text is selected, that method does nothing.
Print
m

(Text)s
'Print some text inside the editor.
'
'The difference with [../insert] is that some control characters are replaced by editor commands.
'
'For example, 'Chr$(12)' will clear the editor, Chr$(8) will delete the character left to the cursor and move the cursor left.
'Some VT-100 sequences are interpreted too.
'
'[[ warning
'This function is deprecated. You should not use it in new code.
']]
FindPreviousString
m
i
(Search)s(&Start)i[(&Column)i]
'Find the previous line containing a specific string or find the previous occurence of a string.
'
'- ~String~ is the string to search. The search is case insensitive.
'- ~Start~ is the line position where the search starts.
'- ~Column~ is the optional line position to search from.
'
'If ~Column~ is supplied then the string is searched from that column, and the result is returned in the ~Start~ and ~Column~ arguments.
'
'If no string is found, '-1' is returned.
FindNextString
m
i
(Search)s(&Start)i[(&Column)i]
'Find the next line containing a specific string or find the next occurence of a string.
'
'- ~String~ is the string to search. The search is case insensitive.
'- ~Start~ is the line position where the search starts.
'- ~Column~ is the optional line position to search from.
'
'If ~Column~ is supplied then the string is searched from that column, and the result is returned in the ~Start~ and ~Column~ arguments.
'
'If no string is found, '-1' is returned.
Reset
m


'Reset the modified and saved flags of each line.
_RaiseHighlight
m

(sText)s
_CheckRowWithFolding
m
i
(Y)i
_CollapseRow
m

(Y)i[(bNoRefresh)b]
_ExpandRow
m

(Y)i
_IsRowVisible
m
b
(Y)i
_GetLastVisibleRow
m
i

_HasFolding
m
b

_IsFirstLineVisible
m
b

SaveCursor
m


'Save the current cursor position and selection range.
'
'Calls to this method and [../restorecursor] can be imbricated.
RestoreCursor
m


'Restore the cursor position and selection range saved by the [../savecursor] method.
'
'Calls to [../savecursor] and this method can be imbricated.
_UpdateLineHeight
m

(Y)i
TimerHeight_Timer
m


Theme_Change
m


TimerCacheLine_Timer
m


SideBar_Draw
m


SideBar_MouseMove
m


SideBar_Enter
m


SideBar_Leave
m


TimerSideBarMouse_Timer
m


SideBar_MouseDown
m


SideBar_MouseUp
m


SideBar_MouseWheel
m


TimerRefreshBar_Timer
m


SideBar_Arrange
m


_SyncFolding
m


SideBarViewer_MouseDown
m


SideBar_Menu
m


_GetFolding
m
Integer[]

GetIndent
m
s
(StartLine)i[(EndLine)i]
'Return the indent of a line or of a line range.
'
'- ~StartLine~ is the first line of the range.
'- ~EndLine~ is the last line of the range (not included). If not specified, the indent of the sole ~StartLine~ is returned.
'
'The indent is the smaller initial space characters part of each line.
GetHighlight
m

(Y)i(&Symbols)String[];(&Types)Integer[];
'Return the highlighting a specific line.
'
'- ~Y~ is the line number.
'- The list of tokens is returned in ~Symbols~.
'- The highlight colors of each token is returnd in ~Types~.
'
'If no highlighting is associated with the specified line, ~Symbols~ and ~Types~ are set to 'NULL'.
HighlightString
m

(Text)s[(IgnoreCase)b(WordOnly)b]
'Highlight a specific string everywhere in the editor.
'
'- ~Text~ is the text to highlight.
'- If ~IgnoreCase~ is 'TRUE', then the text case is ignored.
'- If ~WordOnly~ is 'TRUE', then text is highlighted only if it is a entire word.
'
'The text is highlighted with the [Highlight.Highlight](/comp/gb.eval/highlight/highlight) color.
EnterDiffMode
m

(Added)Integer[];(Removed)Collection;
'Enter "diff mode".
'
'- ~Added~ is the list of line numbers that are added. These lines are highlighted with the [Highlight.Added](/comp/gb.eval/highlight/added) color.
'- ~Removed~ is a collection of string arrays indexed by line number, the string array containing the lines of text that were removed at that line number.
'  The removed lines are highlighted with the [Highlight.Removed](/comp/gb.eval/highlight/removed) color.
'
'In "diff mode", the editor becomes read-only.
'
'## See also
'- [../leavediffmode]
LeaveDiffMode
m


'Leave 'diff mode'.
'
'The editor returns to its normal state.
'
'## See also
'- [../enterdiffmode]
_LeaveDiffMode
m


_Search
m
b
(sText)s[(bMoveNext)b]
IsVoid
m
b

'Return if the editor contents is void.
GetSelectedLines
m
String[]

'@{since 3.16}
'
'Return the selected lines if any.
'
'The selection is first extended so that partially selected lines are included in the selection.
'
'If nothing is selected, 'NULL' is returned
View_Menu
m


mnuUndo_Click
m


mnuRedo_Click
m


mnuCut_Click
m


mnuCopy_Click
m


mnuPaste_Click
m


mnuSelectAll_Click
m


mnuGoto_Click
m


mnuFind_Click
m


#_TextEditor_Line

C
'This virtual class represents a specific line of a [../texteditor].
:_Fake
:


_Line
v
i

Text
p
s

'Return or set the text contents of the line.
'
'You must not put line separator characters (`"\r"` or `"\n"`) in the text of a line.
Length
r
i

'Return the line length in UTF-8 characters.
Limit
r
b

'Return if the line has a limit mark, i.e. if it is the beginning of a function.
InitialState
r
_TextEditor_State

'Return a virtual object that represents the initial highlighting state of the line.
Height
r
i

'Return the line height in pixels.
H
r
i

'Return the line height in pixels.
Expanded
p
b

'Return or set if the line is expanded.
'
'Only lines whose [../limit] is 'TRUE' can be expanded or collapsed.
Breakpoint
p
b

'Return or set if the line is a breakpoint.
Disabled
p
b

'Return or set if the line is a disabled breakpoint.
Bookmark
p
b

'Return or set if the line is a bookmark.
Added
r
b

'Return if the line is an added line in "diff mode".
Refresh
m


'Refresh that line.
Purge
m
s
[(KeepComment)b(KeepString)b(Replace)s]
'Purge the line from its comments and/or strings, according to its highlighting.
'
'- If ~KeepComment~ is set, the comments are kept intact. Comments are the characters associated with [Highlight.Comment](/comp/gb.eval/highlight/comment) or [Highlight.Help](/comp/gb.eval/highlight/help) styles.
'- If ~KeepString~ is set, the strings are kept intact. Strings are the characters associated with [Highlight.String](/comp/gb.eval/highlight/string) style.
'- ~Replace~ is the character that replaces the removed elements. By default it is a space.
'
'If the line is not highlighted, then it is returned as is.
Paint
m

(X)i(Y)i
'Paint that line on the current painter at a specified position.
'
'- ~X~ and ~Y~ are the top left position where the line must be painted.
#_TextEditor_State

C
'This virtual class represents the initial highlighting state of a specific line.
_State
v
CLineInfo

State
r
i

'Return the initial highlighting state value.
Tag
r
i

'Return the initial highlighting tag value.
Alternate
r
b

'Return the initial highlighting alternate flag.
