Cursors (LibreOffice Basic): verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 1: | Regel 1: | ||
− | Op het moment dat je | + | ''Cursors'' hebben betrekking op het navigeren binnen een document, in mijn geval een spreadsheet. Op het moment dat je ergens bent aangeland, en je wilt iets doen met de data waar die cursor naar verwijst, dan lijk je te moeten overstappen op een andere objecttypes, zoals ''cells'' en ''cell ranges'' |
+ | |||
+ | Cursors komen in twee smaken: | ||
* '''View cursors''' hebben betrekking op de manier waarop data wordt weergegeven - Presentatie? | * '''View cursors''' hebben betrekking op de manier waarop data wordt weergegeven - Presentatie? | ||
* '''Text (non-view)-cursors''' hebben betrekking op eigenschappen van data, en minder op de manier waarop data wordt weergegeven - Inhoud? | * '''Text (non-view)-cursors''' hebben betrekking op eigenschappen van data, en minder op de manier waarop data wordt weergegeven - Inhoud? | ||
− | + | Ik geloof dat je cursors altijd kunt uitbreiden tot meerdere cellen [https://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/SheetCellCursor.html]. | |
== Voorbeelden == | == Voorbeelden == |
Huidige versie van 6 nov 2019 om 19:37
Cursors hebben betrekking op het navigeren binnen een document, in mijn geval een spreadsheet. Op het moment dat je ergens bent aangeland, en je wilt iets doen met de data waar die cursor naar verwijst, dan lijk je te moeten overstappen op een andere objecttypes, zoals cells en cell ranges
Cursors komen in twee smaken:
- View cursors hebben betrekking op de manier waarop data wordt weergegeven - Presentatie?
- Text (non-view)-cursors hebben betrekking op eigenschappen van data, en minder op de manier waarop data wordt weergegeven - Inhoud?
Ik geloof dat je cursors altijd kunt uitbreiden tot meerdere cellen [1].
Voorbeelden
o_cursor = ThisComponent.Sheets(0).createCursor() i_rows = o_cursor.getRangeAddress().EndRow+1 msgbox o_cursor.rows.count() # Antwoord: 1048576 o_cursor.gotoStart() o_cursor.gotoEnd()
Componenten
OO_ME, p. 517:
Primary components supported by com.sun.star.sheet.SheetCellCursor service:
com.sun.star.table.CellCursor Methods to control the position of a cell cursor com.sun.star.table.CellRange Methods to access cells or subranges of a cell range com.sun.star.sheet.XSheetCellCursor Advanced methods to control the position of the cursor com.sun.star.sheet.SheetCellRange A rectangular range of cells in a spreadsheet document; this is an extension of the CellRange service for use in spreadsheet documents com.sun.star.sheet.XUsedAreaCursor Methods to find the used area in a sheet.
Methods sheet.SheetCellCursor-service
OO_ME, p. 518 - Waarom staat createCursor hier niet bij?
Interface Method Description ---------------- ------ --------------------- ----------------------------------------------------------- XCellCursor gotoStart() Move the cursor to the first filled cell at the beginning of a contiguous series of filled cells. This cell may be outside the cursor’s range. XCellCursor gotoEnd() Move the cursor to the last filled cell at the end of a contiguous series of filled cells. This cell may be outside the cursor’s range. XCellCursor gotoNext() Move the cursor to the next (right) unprotected cell. XCellCursor gotoPrevious() Move the cursor to the previous (left) unprotected cell. XCellCursor gotoOffset(nCol, nRow) Shift the cursor’s range relative to the current position. Negative numbers shift left and up; positive numbers shift right and down. XCellRange getCellByPosition(left, top) Get a cell within the range. XCellRange getCellRangeByPosition Get a cell range within the range. (left, top, right, bottom) XCellRange getCellRangeByName(name) Get a cell range within the range based on its name. The string directly references cells using the standard formats — such as “B2:D5” or “$B$2” — or defined cell range names. XSheetCellCursor collapseToCurrentRegion() Expand the range to contain all contiguous nonempty cells. XSheetCellCursor collapseToCurrentArray() Expand the range to contain the current array formula. XSheetCellCursor collapseToMergedArea() Expand the range to contain merged cells that intersect the range. XSheetCellCursor expandToEntireColumns() Expand the range to contain all columns that intersect the range. XSheetCellCursor expandToEntireRows() Expand the range to contain all rows that intersect the range. XSheetCellCursor collapseToSize(nCols, nRows) Without changing the upper-left corner, set the cursor range size. XSheetCellRange getSpreadsheet() Get the sheet object that contains the cell range. XUsedAreaCursor gotoStartOfUsedArea() Set the cursor to the start of the used area. XUsedAreaCursor gotoEndOfUsedArea() Set the cursor to the end of the used area.
Bronnen
- OOME, hoofdstuk 14
- https://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/SheetCellCursor.html
- https://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/XSheetCellCursor.html
- https://ask.libreoffice.org/en/question/43606/how-can-i-extract-row-and-column-position-of-currently-selected-cell/