TextEditor (gb.form.editor)

此控件是一个增强的文本编辑器,支持语法高亮显示。

此编辑器具有以下特殊功能:

  • Gambas、HTML、CSS、C、C++、JavaScript、SQL和diff文件的源代码语法高亮显示。

  • 完整支持编辑,包括复制、粘贴、剪切、撤消和重做。

  • 断行!

  • 许多IDE可选显示功能(行编号、块折叠指示器、大括号匹配指示器。。。

  • 编码增强功能,如书签、选项卡扩展、断点指示器。。。

  • 。。。还有更多!

该类继承于 UserControlgb.qt4中.

该类是可创建

该类行为像一个只读数组。

属性
Bookmarks   Return or set the list of lines having a bookmark
Border   Return or set if a border must be drawn around the editor.
Breakpoints   Return or set the list of lines having a breakpoint
CloseBraces   Return or set if braces are automatically closed.
CloseStrings   Return or set if strings are automatically closed.
Column   Return the current column position, starting from zero.
Count   Return the number of lines.
Current   Return the current line as a virtual object.
DiffMode   Return or set if the "diff mode" is activated.
DisabledBreakpoints   Return or set the list of lines having a disabled breakpoint
EndOfLine   Return or set the newline separator used by the editor.
Font  
Highlight   Return or set the highlighting mode.
Keywords   Return the language keywords associated with the editor mode, as defined by the Mode property.
LastColumn   Return the old column position before a cursor move.
LastLine   Return the old line position before a cursor move.
Length   Return the length of the editor contents.
Line   Return the current line position, starting from zero.
LineHeight   Return the height of a line in pixels.
LineNumberOffset   Return or set the line number offset.
Max   Return the number of lines minus one.
Mode   Return or set the editor mode.
Overwrite   Return or set if the editor is in overwrite mode.
ReadOnly   Return or set if the editor is in read-only mode.
Rewrite   Return or set if the highlighter can rewrite the highlighted contents.
ScrollBar  
ScrollH  
ScrollHeight  
ScrollW  
ScrollWidth  
ScrollX  
ScrollY  
Selected   Return if some text is selected.
SelectedText   Return the selected text if any.
SelectionColumn   Return the column position of the selection mark.
SelectionLine   Return the line position of the selection mark.
ShowBraces   Return or set if matching braces are highlighted.
ShowCurrent   Return or set if the current line is highlighted.
ShowCursor   Return or set if the cursor is visible.
ShowExpand   Return or set if the functions can be collapsed and expanded.
ShowIcon   Return or set if the breakpoint or bookmark icons are visible.
ShowIndent   Return or set if indentation is highlighted with vertical lines.
ShowLimit   Return or set if the function limits are visible.
ShowLineNumber   Return or set if the line numbers are displayed.
ShowModified   Return or set if the modified lines are highlighted in the margin.
ShowPosition   Return or set if the cursor current position is displayed.
ShowPreview   Return or set if the editor right scrollbar is replaced by a preview.
ShowSpaces   Return or set if trailing whitespaces are displayed as dots.
StopLine   Return or set the debugger stop line.
Styles   Return a virtual object that allows to define the editor highlighting style.
TabIndent   Return or set if the ident is made of tab characters.
TabSize   Return or set the tab size.
Text   Return or set the editor contents.
Theme   Return or set the theme used for highlighting. Replace the Styles property.
View   Return or set the main view of a editor.
Wrap   Return or set if the editor wraps its contents.

Inherited properties
Action  
Background  
Children  
ClientH  
ClientHeight  
ClientW  
ClientWidth  
ClientX  
ClientY  
Cursor  
Design  
Direction  
Drop  
Enabled  
Expand  
Foreground  
H  
Handle  
HasFocus  
Height  
Hovered  
Id  
Ignore  
Left  
Mouse  
Name  
Next  
NoTabFocus  
Parent  
PopupMenu  
Previous  
Proxy  
RightToLeft  
ScreenX  
ScreenY  
Tag  
Tooltip  
Top  
Tracking  
Visible  
W  
Width  
Window  
X  
Y  

方法
Append   Append some text to the editor's end without moving the cursor.
Begin   Start a serie of changes that will be undone in one shot.
Clear   Clear the editor contents
CollapseAll   Collapse all functions
Copy   Copy the current selected text to the clipboard.
CursorAt   Convert a cursor position into pixel position
Cut   Cut the current selected text and copy it to the clipboard.
End   End a serie of changes.
EnterDiffMode   Enter "diff mode".
ExpandAll   Expand all functions.
FindNextDiff   Find the line position of the next difference.
FindNextLimit   Find the line position of the next function limit.
FindNextString   Find the next line containing a specific string or find the next occurence of a string.
FindPreviousDiff   Find the line position of the previous difference.
FindPreviousLimit   Find the line position of the previous function limit.
FindPreviousString   Find the previous line containing a specific string or find the previous occurence of a string.
GetHighlight   Return the highlighting a specific line.
GetIndent   Return the indent of a line or of a line range.
GetSelectedLines   Return the selected lines if any.
Goto   Move the cursor to the specified position.
GotoCenter   Move the cursor to the specified position and center the view around it.
HideSelection   Hide the current selection if any.
HighlightString   Highlight a specific string everywhere in the editor.
Indent   Indent the selected text, or the current line if there is no selected text.
Insert   Insert some text at the current cursor position.
IsVoid   Return if the editor contents is void.
LeaveDiffMode   Leave diff mode.
Load   Load a file into the editor.
LowerCase   Convert the selected text to lower case.
Paste   Paste the contents of the clipboard inside the editor.
Print   Print some text inside the editor.
Redo   Redo the last undone change.
Refresh   Refresh the editor view.
Remove   Remove the text located between two cursor positions.
Reset   Reset the modified and saved flags of each line.
RestoreCursor   Restore the cursor position and selection range saved by the SaveCursor method.
Save   Save the editor contents into a file.
SaveCursor   Save the current cursor position and selection range.
Scroll  
Select   Select a specific text range.
SelectAll   Select all editor contents
ShowFindPanel   Display the text search panel.
ShowGotoPanel   Display the goto line panel.
ToColumn   Return the column located under the specified mouse cursor position.
ToLine   Return the line located under the specified mouse cursor position.
ToPos   Return the relative position in pixels of a specific cursor position.
ToPosX   Return the relative horizontal position in pixels of a specific cursor position.
ToPosY   Return the relative vertical position in pixels of a specific cursor position.
Undo   Undo the last change.
Unindent   Unindent the selected text, or the current line if there is no selected text.
UpperCase   Convert the selected text to upper case.

Inherited methods
Delete  
Drag  
FindChild  
Grab  
Hide  
Lower  
Move  
MoveScaled  
Raise  
Reparent  
Resize  
ResizeScaled  
SetFocus  
Show  

事件
Change   This event is raised when the editor contents has changed.
Cursor   This event is raised when the cursor has moved.
Highlight   This event is raised when a text line must be highlighted.
Margin   This event is raised when the user has clicked twice inside the margin.
Scroll   This event is raised when the editor has scrolled.

Inherited events
Arrange  
BeforeArrange  
DblClick  
Drag  
DragLeave  
DragMove  
Drop  
Enter  
GotFocus  
KeyPress   KeyPress例程结束后,textbox控件内部的文本被Gambas根据按键编辑。所以它不检测从KeyPress 事件处理程序及其调用的任何子程序和函数中写回进Text 属性的任何信息。而Change事件开始于内容更新之后。
KeyRelease  
Leave  
LostFocus  
Menu  
MouseDown  
MouseDrag  
MouseMove  
MouseUp  
MouseWheel  
NewChild  

Guess where it's used within Gambas itself

Do not use the normal Background and Foreground properties to change the look of a TextEditor.

To change background colors or other highlighting styles within the Editor control you must use the Styles property and a Highlight constant.

For example:

TextEditor1.Styles[Highlight.Background].Color = Color.RGB(200, 200, 200)

See the Highlight class for all available constants.