Scripting:Editor object

From TSWiki

Jump to: navigation, search

The Editor object in WebCoder is one of the most important parts you have access to, since it gives you direct control of the place where it all happens, where you write your code. With access to the Editor control, you can manipulate the content of it, which you will quickly need when writing scripts.

[edit] Access and type

You may access the Editor object from the MainForm object, like this: MainForm.Editor. The Editor control is of the SyntaxEditor type.

[edit] Members

To learn more about the Editor control, select Scripting -> Application structure explorer in WebCoder and select it on the list of controls to the left. You will get a complete list of properties, methods and events.

[edit] Example

Here is an example of using the Editor control. It simply counts the number of lines and characters and tell you about it in a messagebox.

clr.AddReferenceByPartialName("System.Windows.Forms")
from System.Windows.Forms import MessageBox
from System import String

lineCount = MainForm.Editor.Document.Lines.Count
charCount = MainForm.Editor.Document.Length
MessageBox.Show(String.Format("The WebCoder Editor control currently contains {0} lines and {1} characters", lineCount, charCount))
Personal tools