Difference between revisions of "Category:D2Editor"

From Inspired-Lua Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
 +
The Lua 2D editor bindings enable 2D rich text editors to be created and manipulated within the TI-Nspire product.
 +
 
== Quick Overview ==
 
== Quick Overview ==
  

Revision as of 19:22, 18 June 2012

The Lua 2D editor bindings enable 2D rich text editors to be created and manipulated within the TI-Nspire product.

Quick Overview

  • D2Editor:createChemBox() : Inserts a Chem Box in the current cursor position of the editor.
  • D2Editor:createMathBox() : Inserts a Math Box (Expression Box) in the current cursor position of the editor.
  • D2Editor:getExpression() : Returns the contents of the text editor as a UTF-8 encoded string.
  • D2Editor:getExpressionSelection() : Returns three values: the contents of the text editor (UTF-8 encoded string), the cursor position, and the selection start.
  • D2Editor:getText() : same as getExpression : Returns the contents of the text editor as a UTF-8 encoded string.
  • D2Editor:hasFocus() : Returns true if the editor has focus; otherwise returns false.
  • D2Editor:isVisible() : Returns true if the editor is visible; otherwise returns false.
  • D2Editor:move() : Sets the parent-relative location of the upper left corner of the text editor. Both x and y must be between -32767 and 32767.
  • D2Editor:newRichText() : Creates and returns a new 2D rich text editor.
  • D2Editor:registerFilter(handlerTable) : This routine registers a table of handler functions that can alter events before they are sent to the 2D editor widget, or unregisters if nil is passed.
  • D2Editor:resize(w, h) : Changes the width and height of the text editor. Both width and height must be > 0 and < 32768.
  • D2Editor:setBorder(thickness) : Sets the editor's border thickness. The thickness value must be between 0 and 10.
  • D2Editor:setBorderColor(color) : Sets the editor's border color. The color value must be between 0 and 16777215 (0x000000 and 0xFFFFFF).
  • D2Editor:setColorable(true or false) : Makes the expression colorable or uncolorable.
  • D2Editor:setDisable2DinRT(true or false) : Turns on/off 2D layout of math input to the text box.
  • D2Editor:setExpression(...) : Sets the text content of the text editor.
  • D2Editor:setFocus(true or false) : Sets the user input focus on the editor if true (the default). This is usually called from the on.getFocus event handler.
  • D2Editor:setFontSize(size) : Sets the text font size in the editor. Only 7, 9, 10, 11, 12, or 24 for the handheld, any on the desktop software.
  • D2Editor:setMainFont(family, style) : Sets the main font family ("serif" or "sansserif") and style ("r", "b", "i", "bi").
  • D2Editor:setReadOnly(true or false) : Makes the text editor content modifiable (false) or unmodifiable (true) by the user. If a Boolean value is not specified, defaults to true.
  • D2Editor:setSelectable(true or false) : Makes the text editor content selectable (true) or unselectable (false) by the user. If a Boolean value is not specified, defaults to true.
  • D2Editor:setSizeChangeListener(function(editor, w, h)) : Sets the callback function for when the editor contents exceed the current editor size, when the contents fit on fewer lines, or when the contents fit on a single line of smaller width.
  • D2Editor:setTextChangeListener(function(editor)) : Sets the callback function for when the text expression changes, which will be to the editor object. This allows for processing text input as it occurs.
  • D2Editor:setText(...) : Same as setExpression : Sets the text content of the text editor.
  • D2Editor:setTextColor(color) : Sets the editor text color. The color value must be between 0 and 16777215 (0x000000 and 0xFFFFFF).
  • D2Editor:setVisible(true or false) : Sets the visibility of the text editor.
  • D2Editor:setWordWrapWidth(width) : Sets the rich text editor word-wrapping width in pixels. Ignored if the editor is in 2D mode. To indicate widget width, sets to 0. To disable wrapping, sets to < 0. The width must be -32767 to 32767.