SpreadsheetRenderer

Package: Libraries.Interface.Controls.Support · Inherits from: Libraries.Interface.Item, Libraries.Interface.Controls.Control, Libraries.Interface.Item2D, Libraries.Language.Object

The SpreadsheetRenderer class draws a Spreadsheet's cells: only those on screen, from a few reused labels and rectangles, so a large file draws as fast as a small one. It draws the cells' text, the grid lines, the selected range, the current cell's outline, and, over the cells, the column letters across the top and the row numbers down the left, which stay in place while the cells scroll. It also says what is at a place on the screen: a cell, a column letter, the edge of one, a row number, or the corner. Each Spreadsheet makes its own, so most users won't need this class directly. Screen readers don't see what it draws; they learn about the cells from the Spreadsheet.

Example Code

use Libraries.Interface.Controls.Spreadsheet
use Libraries.Interface.Controls.Support.SpreadsheetRenderer
Spreadsheet sheet
SpreadsheetRenderer renderer = cast(SpreadsheetRenderer, sheet:GetScrollableRegion())

Variables

  • integer HIT_COLUMN
  • integer HIT_ROW
  • integer HIT_CORNER: How near the right edge of a column letter, in points, starts a width drag.
  • integer HIT_COLUMN_EDGE
  • integer HIT_CELL
  • integer HIT_NONE

Actions

GetHitColumn()

This action returns the column found by the last HitTest, or -1.

Returns

integer: The column.

GetHitRow()

This action returns the row found by the last HitTest, or -1.

Returns

integer: The row.

GetSpreadsheet()

This action returns the spreadsheet the renderer draws.

Returns

Libraries.Interface.Controls.Spreadsheet: The spreadsheet.

HitTest(number x, number y)

This action says what is at a place on the screen: HIT_CELL, HIT_COLUMN, HIT_COLUMN_EDGE, HIT_ROW, HIT_CORNER or HIT_NONE. GetHitRow and GetHitColumn then give the row and column, or -1.

Parameters

  • x number: The place across the screen.
  • y number: The place up the screen.

Returns

integer: What is there.

MeasureText(text value)

This action returns how wide a text is in the spreadsheet's font, in points before the interface scale. FitColumnWidth uses it.

Parameters

  • value text: The text.

Returns

number: The width.

Refresh()

This action draws the cells on screen again. The Spreadsheet calls it when it scrolls, changes size, or its values or selection change.

SetSpreadsheet(Libraries.Interface.Controls.Spreadsheet sheet)

This action connects the renderer to its spreadsheet. The Spreadsheet calls it.

Parameters

Inherited Actions

264 actions from Libraries.Interface.Controls.Control
61 actions from Libraries.Interface.Item
202 actions from Libraries.Interface.Item2D
3 actions from Libraries.Language.Object