# GraffitiSyntaxEditor
Class Inherits GraffitiWebUIControl
## About
GraffitiSyntaxEditor is a full featured code and text editor component with support for 34 themes, 142 languages (modes), and the following features:
*
Custom Mode Support
*
Custom Theme Support
*
Annotations
*
Breakpoints
*
Single-Line Comment Toggling
*
Block Comment Toggling
*
Built-In Find/Replace
*
Code Folding
*
Single or Multiple Line Indent
*
Print to HTML
*
Selection Modification (Duplication, Lowercase, Number alterations, Move, Split, Transpose by Line, Transpose Characters, Uppercase, By Word)
*
Built-In GoTo by Line Number
*
Undo Stack
*
Code Matching Highlight
*
Autocomplete
*
File Drop Loading
*
Visible Margins
*
Soft or Hard Tabs
*
Tab Size Setting
*
Optional Word Wrap
## Preview





Previous
Next
## Warnings
### Linux Support
Support varies by Linux distribution and installed libwebkit library and version.
### Windows Support
Requires the presence of an HTMLViewer on a window or container within the project.
## Compatibility
### Framework API Version
| 1.0 | 2.0 |
| :---: | :---: |
| True | True |
### Desktop
| 32-Bit | 64-Bit |
| :---: | :---: |
| True | True |
## Attributes
| Name | Value |
| --- | --- |
| DefaultEvent | "Change" |
## Enumerations
| Name | Value | Description |
| --- | :---: | --- |
| AnnotationTypes | Info <br> Warning <br> Error | Supported annotation types. |
| Modes | ABAP <br> ABC <br> ActionScript <br> ADA <br> ApacheConf <br> AppleScript <br> ASCIIDoc <br> AssemblyX86 <br> AutoHotKey <br> BatchFile <br> Bro <br> C_CPP <br> C9Search <br> Cirru <br> Clojure <br> Cobol <br> CoffeeScript <br> ColdFusion <br> CSharp <br> CSS <br> Curly <br> D <br> Dart <br> Diff <br> Django <br> DockerFile <br> Dot <br> Drools <br> Eiffel <br> EJS <br> Elixir <br> Elm <br> ERLang <br> Forth <br> Fortran <br> FTL <br> GCode <br> Gherkin <br> GitIgnore <br> GLSL <br> Gobstones <br> GOLang <br> Groovy <br> HAML <br> Handlebars <br> Haskell <br> HaskellCabal <br> Haxe <br> HJSON <br> HTML <br> HTMLElixir <br> HTMLRuby <br> INI <br> IO <br> Jack <br> Jade <br> Java <br> JavaScript <br> JSON <br> JSONIQ <br> JSP <br> JSX <br> Julia <br> Kotlin <br> LaTeX <br> Lean <br> LESS <br> Liquid <br> LISP <br> Live_Script <br> LiveScript <br> LogIQL <br> LSL <br> LUA <br> LUAPage <br> Lucene <br> MakeFile <br> Markdown <br> Mask <br> MatLab <br> Maze <br> Mel <br> MIPS_Assembler <br> MIPSAssembler <br> MushCode <br> MySQL <br> Nix <br> NSIS <br> ObjectiveC <br> OCAML <br> Pascal <br> Perl <br> PGSQL <br> PHP <br> PlainText <br> PowerShell <br> Praat <br> Prolog <br> Properties <br> Protobuf <br> Python <br> R <br> Razor <br> RDoc <br> RHTML <br> RST <br> Ruby <br> Rust <br> SASS <br> SCAD <br> Scala <br> Scheme <br> SCSS <br> SH <br> SJS <br> Smarty <br> Snippets <br> SoyTemplate <br> Space <br> SQL <br> SQLServer <br> Stylus <br> SVG <br> Swift <br> Swig <br> TCL <br> Tex <br> Text <br> Textile <br> TOML <br> TSX <br> Twig <br> TypeScript <br> Vala <br> VBScript <br> Velocity <br> Verilog <br> VHDL <br> Wollok <br> XML <br> Xojo <br> XQuery <br> YAML <br> Custom | Supported syntax highlighting languages. |
| Themes | Ambiance <br> Chaos <br> Chrome <br> Clouds <br> CloudsMidnight <br> Cobalt <br> CrimsonEditor <br> Dawn <br> Dreamweaver <br> Eclipse <br> GitHub <br> IdleFingers <br> iPlastic <br> Katzenmilch <br> KRTheme <br> Kuroir <br> Merbivore <br> MerbivoreSoft <br> MonoIndustrial <br> Monokai <br> PastelOnDark <br> SolarizedDark <br> SolarizedLight <br> SQLServer <br> Terminal <br> TextMate <br> Tomorrow <br> TomorrowNight <br> TomorrowNightBlue <br> TomorrowNightBright <br> TomorrowNightEighties <br> Twilight <br> VibrantInk <br> XCode <br> Custom | Supported themes. |
## Event Definitions
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| BreakpointAdded | Row as Integer | (None) | Breakpoint has been added by the user. |
| BreakpointRemoved | Row as Integer | (None) | Breakpoint has been removed by the user. |
| Change | (None) | (None) | Text content has changed. |
| FileDropped | Name as String <br> Content as String | (None) | The user has dropped a file on the component. |
| FocusLost | (None) | (None) | |
| FocusReceived | (None) | (None) | |
| FoldAdded | startRow as Integer <br> endRow as Integer | (None) | Raised when the user folds a code block. |
| FoldRemoved | startRow as Integer <br> endRow as Integer | (None) | Raised when the user unfolds a code block. |
| Opening | (None) | (None) | |
| SelChange | (None) | (None) | Selected text has changed. |
| TextDropped | Content as String | Boolean | Raised when the user has dropped text dragged from another application on to the control. |
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| Sub | AddAnnotation | (None) | Adds an annotation to the right-hand gutter. |
| Sub | AddBreakpoint | (None) | Adds a breakpoint. |
| Sub | AddMode | (None) | Adds the specified mode to the component. modeSource should be the JavaScript source of the mode to add. |
| Sub | AddTheme | (None) | Adds the specified theme to the component. themeSource should be the JavaScript source of the theme to add. |
| Sub | CenterSelection | (None) | Centers the currently selected text in the viewport. |
| Sub | ClearAnnotations | (None) | Remove all annotations. |
| Sub | ClearBreakpoints | (None) | Remove all breakpoints. |
| Sub | ClearHistory | (None) | Flush Undo/Redo buffers. |
| Sub | CommentBlockToggle | (None) | Toggle block commenting of the current selection. |
| Sub | CommentToggle | (None) | Toggle single commenting of the current selection. |
| Sub | Copy | (None) | Copies the currently selected text to the clipboard. |
| Sub | Cut | (None) | Copies then deletes the selected text. |
| Sub | Delete | (None) | Deletes the currently selected text from the content. |
| Sub | DeselectAll | (None) | Deselect all text. |
| Sub | Find | (None) | Search for toFind in the text. |
| Sub | FindAll | (None) | Find all instances of toFind in the text. |
| Sub | FindNext | (None) | Finds the next instance of the text. Requires there first be a Find call. |
| Sub | FindPrev | (None) | Finds the previous instance of the text. Requires there first be a Find call. |
| Sub | Fold | (None) | Folds the currently selected block. |
| Sub | FoldAll | (None) | Folds all blocks in the document. |
| Function | GetFolds | As | Returns all currently folded block coordinates. |
| Function | GetLine | As | Get full line text. |
| Sub | GotoLine | (None) | Go to the specified line within the text. |
| Sub | GotoPageDown | (None) | Go to line one page below current selection. |
| Sub | GotoPageUp | (None) | Go to line one page above current selection. |
| Sub | Indent | (None) | Indent the current line. |
| Sub | InsertLines | (None) | Insert lines at selection. |
| Sub | InsertText | (None) | Insert theText at current selection. |
| Function | IsBreakpoint | As | Determine if the specified row has a breakpoint assigned. |
| Function | IsRowFolded | As | Returns whether the specified row is within a currently folded code block. |
| Sub | MatchingExpandTo | (None) | Expands the current selection within matching blocks. |
| Sub | MatchingJumpTo | (None) | Moves the cursor to the matching block element corresponding to the current selection. |
| Sub | NavigateDown | (None) | Move the cursor down. |
| Sub | NavigateEnd | (None) | Move the cursor to the end of the document. |
| Sub | NavigateLeft | (None) | Move the cursor left by the specified number of characters. |
| Sub | NavigateLineEnd | (None) | Move cursor to the end of the line. |
| Sub | NavigateLineStart | (None) | Move cursor to the start of the line. |
| Sub | NavigateRight | (None) | Move the cursor right by the specified number of characters. |
| Sub | NavigateStart | (None) | Move the cursor to the start of the document. |
| Sub | NavigateTo | (None) | Move cursor to specified position. |
| Sub | NavigateUp | (None) | Move the cursor up by the specified number of lines. |
| Sub | NavigateWordLeft | (None) | Move cursor one word to the left. |
| Sub | NavigateWordRight | (None) | Move cursor one word to the right. |
| Sub | Outdent | (None) | Remove an indent from the current line. |
| Sub | Paste | (None) | Pastes the clipboard text in to the content at the current cursor position. |
| Function | PrintDocument | As | Creates a printable format file for the content, then launches the browser to automatically print. Returns a FolderItem in case you wish to retain a copy. |
| Sub | Redo | (None) | Redo an undone change. |
| Sub | RemoveAnnotation | (None) | Removes an annotation from the specified line. |
| Sub | RemoveBreakpoint | (None) | Removes a breakpoint from the specified line. |
| Sub | Replace | (None) | Replaces instance with replaceWith. Requires Find or FindAll to be called first. |
| Sub | ReplaceAll | (None) | Replaces all instances with replaceWith. Requires Find or FindAll to be called first. |
| Sub | SelectAll | (None) | Select all text in the document. |
| Sub | SelectDown | (None) | Selects down one line. |
| Sub | SelectionCopyLinesDown | (None) | Copies the currently selected content on to the following line. |
| Sub | SelectionCopyLinesUp | (None) | Copies the currently selected content on to the preceding line. |
| Sub | SelectionDuplicate | (None) | Duplicates the currently selected text within the document. |
| Sub | SelectionLowercase | (None) | Modified the currently selected text to lowercase. |
| Sub | SelectionModifyNumber | (None) | Modifies the currently selected number adding Delta. |
| Sub | SelectionMoveLines | (None) | Moves the selected text down one line. |
| Sub | SelectionMoveLinesUp | (None) | Moves the selected text up one line. |
| Sub | SelectionSplitLine | (None) | Splits the current line at the cursor position. |
| Sub | SelectionTranspose | (None) | Reverses the order of the currently selected lines. |
| Sub | SelectionTransposeLetters | (None) | Reverses the characters of the currently selected text. |
| Sub | SelectionUppercase | (None) | Modifies the currently selected text to uppercase. |
| Sub | SelectLine | (None) | Select entire current line. |
| Sub | SelectPageDown | (None) | Selects the next page of document. |
| Sub | SelectPageUp | (None) | Selects the previous page of content. |
| Sub | SelectToEnd | (None) | Selects all content from the current cursor position to the end of the document. |
| Sub | SelectToStart | (None) | Selects all content from the current cursor position to the beginning of the document. |
| Sub | SelectUp | (None) | Selects up one line. |
| Sub | SelectWord | (None) | Select word that the cursor currently resides in. |
| Sub | SelectWordLeft | (None) | Select word to the immediate left of the cursor. |
| Sub | SelectWordRight | (None) | Select word to the immediate right of the cursor. |
| Sub | SetFocus | (None) | |
| Sub | ShowFind | (None) | Shows the built-in find panel. |
| Sub | ShowGotoLine | (None) | Shows the built-in “Go to Line” panel. |
| Sub | ShowReplace | (None) | Shows the built-in replace panel. |
| Sub | ShowSettingsMenu | (None) | Show a panel containing current control settings. Changes here are not reflected in the control's properties. |
| Sub | ShowShortcutsMenu | (None) | Shows a panel containing a list of the default keyboard shortcuts for the editor. |
| Function | toHTML | As | Exports the current content of the editor as styled HTML. |
| Sub | Undo | (None) | Reverse a change. |
| Sub | Unfold | (None) | Unfolds the currently selected block. |
| Sub | UnfoldAll | (None) | Unfolds all folded blocks in the document. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| Autocomplete | Boolean | Nil | When True, the editor will show a popup with suggestions while typing. |
| AutoMatching | Boolean | Nil | Enables automatic matching of parens. |
| CanRedo | Boolean | Nil | If true, there are actions in the history which can be redone. |
| CanUndo | Boolean | Nil | If true, there are actions in the history which can be undone. |
| CurrentColumn | Integer | Nil | Current column of the cursor within the document. |
| CurrentLine | Integer | Nil | Current line of the cursor within the document. |
| DisplayIndentGuides | Boolean | Nil | Controls the display of indent guides. |
| Enabled | Boolean | Nil | |
| FadeFoldWidgets | Boolean | Nil | When True, fold widgets will fade out when the block is not hovered. |
| FileDropAllowed | Boolean | Nil | When True, users can drop files on the component in an attempt to load them into the editor. |
| FileDropCaption | String | Nil | Text displayed in the file drop capture interface. |
| FileDropCaptionWorking | String | Nil | Text displayed in the file drop capture interface while a file is being read. |
| FontFamily | String | Nil | Sets the editor to use the provided HTML -supported font family. |
| FontSize | Integer | Nil | Size of the font used to display text in the viewport. |
| IsDirty | Boolean | Nil | When True, the Xojo properties of the component may not yet reflect the true values. Wait for IsDirty = True before saving. |
| Mode | Modes | Nil | When Mode = Custom, this will select the mode supplied via AddMode. |
| ModeName | String | Nil | When Mode = Custom, this will select the mode supplied via AddMode. |
| PrintMarginColumn | Integer | Nil | Width of the print margin in pixels. |
| Private | | Dictionary | |
| Private | | Integer | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | | String | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | = | |
| SelLength | Integer | Nil | Length of current selection. |
| SelStart | Integer | Nil | Starting point of current selection. |
| SelText | String | Nil | Currently selected text. |
| ShowFoldWidgets | Boolean | Nil | Controls the display of code folding widgets. |
| ShowGutter | Boolean | Nil | Determines visibility of the line number and breakpoint gutter. |
| ShowInvisibles | Boolean | Nil | Controls the display of invisible characters. |
| ShowPrintMargin | Boolean | Nil | When True, the print margin is displayed on the right side. |
| TabSize | Integer | Nil | Length, in characters, of an indent/outdent/tab. |
| Text | String | Nil | Text content of the editor. |
| Theme | Themes | Nil | The visual style of the editor, including colors for syntax hightlighting. |
| ThemeName | String | Nil | Custom theme to apply. |
| UseSoftTabs | Boolean | Nil | When True, tabs are inserted as a series of spaces. |
| WordWrap | Boolean | Nil | When true long lines will wrap down the next line. |