tableview.go
func (l *TableView) VisibleArea() (firstCol, firstRow, colCount, rowCount int) {
	firstRow = l.topRow
	maxDy := l.height - 3
	if firstRow+maxDy < l.rowCount {
		rowCount = maxDy
	} else {
		rowCount = l.rowCount - l.topRow
	}

	total := l.width - 1
	if l.showRowNo {
		total -= l.counterWidth()
		if l.showVLines {
			total--
		}
	}

	colNo := l.topCol
	colCount = 0
	for colNo < len(l.columns) && total > 0 {
		w := l.columns[colNo].Width
		total -= w
		colNo++
		colCount++
	}

	return l.topCol, l.topRow, colCount, rowCount
}
func (l *TableView) VisibleArea() (firstCol, firstRow, colCount, rowCount int) {
	firstRow = l.topRow
	maxDy := l.height - 3
	if firstRow+maxDy < l.rowCount {
		rowCount = maxDy
	} else {
		rowCount = l.rowCount - l.topRow
	}

	total := l.width - 1
	if l.showRowNo {
		total -= l.counterWidth()
		if l.showVLines {
			total--
		}
	}

	colNo := l.topCol
	colCount = 0
	for colNo < len(l.columns) && total > 0 {
		w := l.columns[colNo].Width
		total -= w
		colNo++
		colCount++
	}

	return l.topCol, l.topRow, colCount, rowCount
}
func ( l * TableView ) VisibleArea ( ) ( firstCol , firstRow , colCount , rowCount int ) { firstRow = l . topRow maxDy := l . height - 3 if firstRow + maxDy < l . rowCount { rowCount = maxDy } else { rowCount = l . rowCount - l . topRow } total := l . width - 1 if l . showRowNo { total -= l . counterWidth ( ) if l . showVLines { total -- } } colNo := l . topCol colCount = 0 for colNo < len ( l . columns ) && total > 0 { w := l . columns [ colNo ] . Width total -= w colNo ++ colCount ++ } return l . topCol , l . topRow , colCount , rowCount }
// VisibleArea returns which rows and columns are currently visible. It can be
// used instead of OnBeforeDraw event to prepare the data for drawing without
// waiting until TableView starts drawing itself.
// It can be useful in case of you update your database, so at the same moment
// you can request the visible area and update database cache - it can improve
// performance.
// Returns:
// * firstCol - first visible column
// * firstRow - first visible row
// * colCount - the number of visible columns
// * rowCount - the number of visible rows
VisibleArea returns which rows and columns are currently visible . It can be used instead of OnBeforeDraw event to prepare the data for drawing without waiting until TableView starts drawing itself . It can be useful in case of you update your database so at the same moment you can request the visible area and update database cache - it can improve performance . Returns : * firstCol - first visible column * firstRow - first visible row * colCount - the number of visible columns * rowCount - the number of visible rows