The
psheetSelection type is used to find out the advanced characteristics of a selection in a Spreadsheet control. The characteristics of this selection are returned by several WLanguage properties.
The
.Selection property gets a variable of type
psheetSelection.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see
Declaring a variable.
sel is psheetSelection = PSHEET_MySpreadsheet.Selection
IF sel.Type = psheetSelSimpleCell THEN
// Display the cell name in the status bar
STATUSBAR = sel.MinCell
END
t is psheetSelection
t = PSHEET_NoName1.Selection
SWITCH t.Type
CASE psheetSelSimpleCell: Trace("You have selected only one cell.")
CASE psheetSelSimpleHeader: Trace("You have selected only one header.")
CASE psheetSelMultiCell: Trace("You have selected several cells.")
CASE psheetSelMultiHeader: Trace("You have selected several headers.")
CASE psheetSelRectCell: Trace("You have selected several cells (rectangle).")
CASE psheetSelEmpty: Trace("You haven't selected any cells.")
CASE psheetSelAll: Trace ("You have selected the entire worksheet.")
OTHER CASE
END
te is array of strings = t.Header
tc is array of strings = t.Cell
Trc is array of strings = t.RectCell
Trace("-----------------------------")
Trace("")
Trace("Min cell:", t.MinCell)
Trace("Max cell:", t.MaxCell)
Trace("-----------------------------")
Trace("")
Trace("Browse of headers")
FOR I = 1 TO te.Occurrence
Trace("header " + I + ":", te[I])
END
Trace("-----------------------------")
Trace("")
Trace("Browse of cells")
FOR I = 1 TO tc.Occurrence
Trace("cell " + i + ":", tc[i])
END
Trace("-----------------------------")
Trace("")
Trace("Browse of rectangle of cells")
FOR I = 1 TO Trc.Occurrence
Trace("rect cell " + i + ":", Trc[i])
END
Trace("-----------------------------")
Trace("")
Remarks
Properties specific to the description of psheetSelection variables
The following properties can be used to handle a selection in a Spreadsheet control:
| | |
Property name | Type used | Effect |
---|
Cell | Array of strings | Array of selected cells. The cells are sorted according to the selection order. This property is read-only. |
Header | Array of strings | Selected headers (headers of selected rows and/or columns). This property is read-only. |
MaxCell | Character string | Maximum selected cell, which means the cell found at the bottom right of the rectangle defining the selection of cells. This property is read-only. |
MinCell | Character string | Minimum selected cell, which means the cell found at the top left of the rectangle defining the selection of cells. This property is read-only. |
RectCell | Array of strings | Array of rectangles of selected cells. Example: "A1:B2" This property is read-only. |
Type | Integer constant | Type of selection: - psheetSelMultiCell: Several cells are selected.
- psheetSelMultiHeader: Several headers are selected.
- psheetSelRectCell: Several cells are selected and they define a rectangle.
- psheetSelSimpleCell: A single cell is selected.
- psheetSelSimpleHeader: A single header is selected.
- psheetSelAll: The entire worksheet is selected.
- psheetSelEmpty: No selection.
This property is read-only. |