SpreadsheetEdit

Package: Libraries.Interface.Undo · Inherits from: Libraries.Language.Object, Libraries.Interface.Undo.Edit

The SpreadsheetEdit class is one step a Spreadsheet can undo and redo: cells typed, cleared, pasted or replaced, rows added or removed, or columns added or removed. It keeps copies of the rows as they were before and after the step, and where the selection was. The Spreadsheet makes these as the user edits and adds them to its SpreadsheetEditManager, so most users won't need this class directly.

Example Code

use Libraries.Interface.Controls.Spreadsheet
use Libraries.Interface.Undo.SpreadsheetEditManager
Spreadsheet sheet
sheet:LoadFromCommaSeparatedValue("a,b")
sheet:Select(0, 0)
sheet:ClearSelectionAsUser()
SpreadsheetEditManager edits = sheet:GetEditManager()
edits:Undo()
output sheet:GetText(0, 0)

Variables

  • integer INSERTED_ROWS: Rows were put in at an index.
  • integer ROWS: Some rows changed in place; rows may have been added at the end.
  • integer REMOVED_ROWS: Rows were taken out at an index.
  • integer EVERYTHING: Everything changed, as columns being added or removed does.

Actions

GetMode()

This action returns the kind of step: ROWS, INSERTED_ROWS, REMOVED_ROWS or EVERYTHING.

Returns

integer: The kind of step.

GetRedoName()

This action returns "Redo" and the step's name.

Returns

text: The name for a Redo menu item.

GetUndoName()

This action returns "Undo" and the step's name, such as "Undo Typing in C2".

Returns

text: The name for an Undo menu item.

Redo()

This action does the step again, after it was undone.

SetEverything(Libraries.Containers.Array<Libraries.Interface.Controls.Support.SpreadsheetRow> allBefore, Libraries.Containers.Array<number> widthsBefore, Libraries.Containers.Array<Libraries.Interface.Controls.Support.SpreadsheetRow> allAfter, Libraries.Containers.Array<number> widthsAfter)

This action records every row and the column widths before and after, for an EVERYTHING step. The Spreadsheet calls it.

Parameters

SetMovedRows(integer index, Libraries.Containers.Array<Libraries.Interface.Controls.Support.SpreadsheetRow> rows)

This action records rows put in or taken out at an index, for an INSERTED_ROWS or REMOVED_ROWS step. The Spreadsheet calls it.

Parameters

SetRows(Libraries.Containers.Array<integer> indices, Libraries.Containers.Array<Libraries.Interface.Controls.Support.SpreadsheetRow> before, Libraries.Containers.Array<Libraries.Interface.Controls.Support.SpreadsheetRow> after, integer countBefore, integer countAfter)

This action records changed rows, for a ROWS step. The Spreadsheet calls it.

Parameters

SetSelections(Libraries.Containers.Array<integer> selectionBefore, Libraries.Containers.Array<integer> selectionAfter)

This action records where the selection was before and after the step. Each array holds the row, the column, the anchor's row, the anchor's column and the kind. The Spreadsheet calls it.

Parameters

Setup(Libraries.Interface.Controls.Spreadsheet sheet, integer mode, text name)

This action sets the spreadsheet, the kind of step and its name, such as "Typing in C2". The Spreadsheet calls it.

Parameters

Undo()

This action puts the spreadsheet back as it was before the step.

Inherited Actions

3 actions from Libraries.Interface.Undo.Edit
3 actions from Libraries.Language.Object