A single-line or multi-line edit widget. Only handles text with one font and one color, and is capable of line or word wrapping. TRAPS: - multiline : boolean -- If true, edit widget will expand vertically to handle newlines. - editable : boolean -- If true, the user can insert, paste and delete text. - disabled : boolean -- If false, user can select text and copy to clipboard. - wrap : string -- Either "none", "line" or "word", specifing the form of text wrap to use. - selection : string -- Returns the currently selected text. Putting values does nothing, see FUNCTIONS, selectText(). - text : string -- Represents the complete text of this edit widget. Can be read and written to. - limit : int -- A limit imposed on the total number of characters in the edit widget. 0 > limit means no limit. - textcolor : color -- Color of the text. - selectcolor : color -- Background Color of the currently selected text. - selecttextcolor : color -- Color of the currently selected text. - textChanged : boolean -- Set to true when the contents of the edit widget has changed. FUNCTIONS: If you wish to directly manipulate the contents of the edit widget consider using these functions to speed up manipulation. All line references are based on hard carrige returns. You do not have to consider soft line wraps when making calculations. - insertText(line, index, text) - Insert text at given char index on given line. - deleteText(startline, startindex, endline, endindex) - Delete text in given range. - selectText(startline, startindex, endline, endindex) - Select text in given range. - clearSelection() - Deselect any current selection. - deleteSelection() - Delete the text within the current selection range. - moveCursor(line, index) - Move the cursor to the given position. THEME NOTES: - Most of the implementation of this widget does not need to be considered in a theme, however a particular theme may wish to override _KeyPressed to add extra theme features (eg. Monopoly word skip on Ctrl+Left Arrow). IMPLEMENTATION NOTES: - In the implementation of the edit widget, there are two systems (loosely similar to model-view) used to reference text. The first, referencing each 'hard' line (from one carrige return to the next) as a box inside $content with the string property fulltext representing the contents of the row is used as the text model. Text is inserted, removed and read using the $content[cl].fulltext properties. The second is the on screen reprsentation of the text. Each $content[cl] box can have any number of children ( must be > 0) called 'soft' lines. These softlines are created/managed at the discretion of the $content[cl]._fulltext trap. This means different wrapping systems can be completely isolated inside the _fulltext trap. The only components of the system that work outside of the model are cursor and selection positioning. The functions that manipulate these features have public functions that mimic the 'model' style functions, but also have private internal functions that use cy and px variables to reference location. - A reference to each cursor is stored in the static area, and a global thread is used to call the _blink trap on cursors. - Boxes are also stored in a static array when unused, however the effective value of this is questionable, and should be properly benchmarked. - If moving the cursor to a different cl line after changing the structure of the edit box, be sure to call the funciton from a background thread. Otherwise, the position x,y values will be wrong. TODO: - keep length value up to date so limit checking works. - insert key