Libraries.Interface.Undo.TextBoxEditManager Documentation

Inherits from: Libraries.Interface.Events.TextChangeListener, Libraries.Language.Object, Libraries.Interface.Undo.EditManager

Variables Table

VariablesDescription
integer SPECIAL_STATEThis state is used for saving more complex actions such as adding multiple indentations to the text box. If the text box is set to this the text box wont leave it until it is switched out to the RESET_STATE
integer RESET_STATEThe manager will be in this state when it is ready for changes to the TextBox.
integer ADD_WORD_STATEThis state is for when a word is being added to the TextBox
integer OFF_STATEThis state is used for turning off the manager. This means that the manager will no longer have any edits and will try to make any new ones. Different from the NULL_STATE in that the OFF_STATE is mainly for use in TextBoxes that do need Undo functionality
integer ADD_SPACE_STATEThis state is for when whitespace is being added to the TextBox
integer NULL_STATEThis state is used to tell the edit manager to ignore any upcoming changes to the TextBox. The manager will not leave this state until set to another
integer DELETE_WORD_STATEThis state is for when a word is being deleted from the TextBox
integer DELETE_SPACE_STATEThis state is for when whitespace is being deleted from the TextBox

Actions Documentation

Add(Libraries.Interface.Undo.Edit undo)

The Add(Edit) action adds an item to the undo list. The redo list cannot be directly added to and is, instead, controlled by undoing.

Parameters

Example

use Libraries.Interface.Undo.EditManager
use Libraries.Interface.Undo.Edit

EditManager edits
Edit edit
edits:Add(edit)
edits:Undo()

CanRedo()

This action checks to see if there is any items that can be redone. If so, it returns true.

Return

boolean: whether we can redo

Example

use Libraries.Interface.Undo.EditManager
use Libraries.Interface.Undo.Edit

EditManager edits
Edit edit
edits:Add(edit)
output edits:CanRedo()

CanUndo()

If true is passed this will empty the manager and it will no longer save any states until called again with false

Return

boolean:

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Empty()

This action empties the EditManager of all edits. In the process, it clears the current state and calls dispose on each edit to ensure it has the opportunity to free any resources.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)

GetCurrentState()

This state is for when whitespace is being added to the TextBox

Return

integer:

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetRedoCount()

This action returns how many edits there are in the redo list.

Return

integer: how many edits are in the redo list

Example

use Libraries.Interface.Undo.EditManager
use Libraries.Interface.Undo.Edit

EditManager edits
Edit edit
edits:Add(edit)
output edits:GetRedoCount()

GetTextBox()

This state is for when a word is being deleted from the TextBox

Return

Libraries.Interface.Controls.TextBox:

GetUndoCount()

This action returns how many edits there are in the undo list.

Return

integer: how many edits are in the undo list

Example

use Libraries.Interface.Undo.EditManager
use Libraries.Interface.Undo.Edit

EditManager edits
Edit edit
edits:Add(edit)
output edits:GetUndoCount()

Redo()

do the undo

Reset()

Saves the current Edit and sets the state to RESET

SetOff(boolean off)

If true is passed this will empty the manager and it will no longer save any states until called again with false

Parameters

  • boolean off

SetSpecialAction(boolean start)

do the redo

Parameters

  • boolean start

SetTextBox(Libraries.Interface.Controls.TextBox newBox)

This state is for when whitespace is being deleted from the TextBox

Parameters

SetToIgnore(boolean ignore)

If true then the Edit Manager will be in the NULL_STATE and will ignore any text change events until set to false

Parameters

  • boolean ignore

TextChanged(Libraries.Interface.Events.TextChangeEvent event)

Saves the current Edit and sets the state to RESET

Parameters

Undo()

This state is for when a word is being added to the TextBox