Поле | Тип | R/W | По умолчанию |
|
|
|
|
Align | INTEGER | RW | alNone |
| Align определяет как компонент располагается на родительской форме
|
BorderStyle | INTEGER | RW | bsSingle |
Cell | 2D ARRAY of STRING | RW | |
| Cell(X, Y) is an array of strings, one string for each cell in the grid.
X = Column, Y = Row
|
Col | INTEGER | RW | |
| Col is the index of the column that contains the selected cell.
|
ColCount | INTEGER | RW | 5 |
Color | INTEGER | RW | |
ColumnList | ARRAY of STRING | RW | |
| ColumnList maintains a list of strings deliminated by LF for use in Columned lists.
|
ColumnStyle | ARRAY of INTEGER | RW | gcsNone |
| ColumnStyle determines the style of each column.
0 = gcsList -- Column with a drop-down list for each item
1 = gcsEllipsis -- Column with an ellipsis button for each item
2 = gcsNone -- Normal column
|
ColWidths | ARRAY of INTEGER | RW | |
| ColWidths is an indexed array giving the width в пикселях of all the columns in the grid.
|
Cursor | INTEGER | RW | crDefault |
DefaultColWidth | INTEGER | RW | 64 |
DefaultRowHeight | INTEGER | RW | 24 |
EditorMode | INTEGER | RW | |
Enabled | INTEGER | RW | True |
FixedColor | INTEGER | RW | |
FixedCols | INTEGER | RW | 1 |
| FixedColss is the number of columns on the left of the grid that cannot be scrolled.
|
FixedRows | INTEGER | RW | 1 |
| FixedRows is the number of rows on the top of the grid that cannot be scrolled.
|
Font | QFONT | W | |
GridHeight | INTEGER | RW | |
GridLineWidth | INTEGER | RW | 1 |
GridWidth | INTEGER | RW | |
Handle | INTEGER | R | |
Height | INTEGER | RW | |
Hint | STRING | RW | |
Left | INTEGER | RW | 0 |
LeftCol | INTEGER | RW | |
Parent | QFORM/QPANEL/QTABCONTROL | W | |
PopupMenu | QPOPUPMENU | W | |
Row | INTEGER | RW | |
| Row is the index of the row that contains the selected cell.
|
RowCount | INTEGER | RW | 5 |
RowHeights | ARRAY of INTEGER | RW | |
| RowHeights is an indexed array giving the height в пикселях of all the rows in the grid.
|
ScrollBars | INTEGER | RW | ssBoth |
Separator | STRING | RW | |
| Separator determines how the stringgrid should parse (ie. read/write) grid data. For example, you can save the grid data в файл, with each item deliminated by the Separator.
|
ShowHint | INTEGER | RW | False |
TabOrder | INTEGER | RW | |
TabStops | ARRAY of INTEGER | RW | |
Tag | INTEGER | RW | |
Top | INTEGER | RW | 0 |
TopRow | INTEGER | RW | |
Visible | INTEGER | RW | True |
VisibleColCount | INTEGER | R | |
VisibleRowCount | INTEGER | R | |
Width | INTEGER | RW | |
Метод | Тип |
| Описание |
Параметры |
AddOptions |
SUBI |
Add options to string grid | |
|
CONST goFixedVertLine = 0
Если так, horizontal lines appear between the rows within nonscrolling
regions.
CONST goFixedHorzLine = 1
Если так, vertical lines appear between the columns within nonscrolling
regions.
CONST goVertLine = 2
Если так, vertical lines appear between the columns
CONST goHorzLine = 3
Если так, horizontal lines appear between the rows.
CONST goRangeSelect = 4
Если так, the user can select a range of cells at one time. When goEditing
is True, the user can no longer select a range of cells.
CONST goDrawFocusSelected = 5
Если так, the cell with the focus is colored 'the same as other cells in a
selected block are colored. When False, the cell with the focus remains the
color of all unselected cells, the color specified with the grid Color
property.
CONST goRowSizing = 6
Если так, rows can be resized individually except for fixed or nonscrolling
rows.
CONST goColSizing = 7
Если так, columns can be resized individually except for fixed or
nonscrolling columns.
CONST goRowMoving = 8
Если так, the user can move a row to a new location in the grid using the
mouse.
CONST goColMoving = 9 Если так, the
user can move a column to a new location in the grid using the mouse.
CONST goEditing = 10
Если так, the user can edit the text in the grid. When goEditing is True,
the user cannot select a range of cells at one time.
CONST goTabs = 11 Если так,
the user can use the Tab and Shift-Tab keys to move from column to column in
the grid.
CONST goRowSelect = 12
Если так, the user can only whole rows at a time instead of individual
cells.
CONST goAlwaysShowEditor = 13
Если так, the grid is in automatic edit mode 'if goEditing is also True.
When the grid is in automatic edit mode, the user does not have to press
Enter or F2 before editing the contents of a cell. When goAlwaysShowEditor
is False and goEditing is True, the user must press Enter or F2 before
editing the contents of a cell. If goEditing is False, setting
goAlwaysShowEditor to True has no effect.
CONST goThumbTracking = 14 When
True, the contents of the grid scrolls while the user is moving the thumb
tab of the grid scroll bar. When False, the contents of the grid doesn't
scroll until the user releases the thumb tab in its new position.
'-- ColumnStyles
CONST gcsList = 0
CONST gcsEllipsis = 1
CONST gcsNone = 2
|
INTEGER, Infinite |
DeleteCol |
SUB (Column%) |
Deletes/Remove a column |
1 |
DeleteRow |
SUB (Row%) |
Deletes/Remove a row |
1 |
DelOptions |
SUBI |
Delete options from string grid |
INTEGER, Infinite |
Circle |
SUB (x1%, y1%, x2%, y2%, c%, fill%) |
Рисует и заливает окружность |
6 |
CopyRect |
SUB (D, Image, S) |
D и S это QRECTs, Image может быть QImage, QCanvas, или QBitmap |
3 |
Draw |
SUB (x%, y%, BMP) |
Рисовать BitMap at (X,Y) |
3 |
FillRect |
SUB (x1%, y1%, x2%, y2%, c%) |
Рисует и заливает цветом прямоугольник |
5 |
InsertCol |
SUB (Column%) |
Inserts a blank column |
1 |
InsertRow |
SUB (Row%) |
Inserts a blank row |
1 |
Line |
SUB (x1%, y1%, x2%, y2%, c%) |
Рисует линию |
5 |
LoadFromFile |
SUB (File$, RowOffset%, ColOffset%, MaxRows%) |
Loads table from file w/Separator |
4 |
LoadFromStream |
SUB (S AS QFileStream/QMemoryStream, RowOffset%, ColOffset%, MaxRows%) |
Loads table from stream w/Separator |
4 |
Paint |
SUB (x%, y%, c%, borderc%) |
Заполняет область |
4 |
Pset |
SUB (x%, y%, c%) |
Рисует точку |
3 |
Rectangle |
SUB (x1%, y1%, x2%, y2%, c%) |
Рисует прямоугольник |
5 |
Repaint |
SUB |
Перерисовать of stringgrid |
0 |
RoundRect |
SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) |
Рисует & Заполняет цветом прямоугольник со скругленными углами |
7 |
SaveToFile |
SUB (File$, RowOffset%, ColOffset%, MaxRows%) |
Saves table to file w/Separator |
4 |
SaveToStream |
SUB (S AS QFileStream/QMemoryStream, RowOffset%, ColOffset%, MaxRows%) |
Saves table to stream w/Separator |
4 |
SwapCols |
SUB (Col1%, Col2%) |
Swap two columns | 2 |
SwapRows |
SUB (Row1%, Row2%) |
Swap two rows | 2 |
StretchDraw |
SUB (Rect AS QRECT, BMP) |
Рисует BMP и растягивает его до заполнения заданного прямоугольника |
2 |
TextHeight |
FUNCTION (Text$) AS WORD |
Возвращает высоту, в пикселях, строки Text$ |
1 |
TextWidth |
FUNCTION (Text$) AS WORD |
Возвращает ширину, в пикселях, строки Text$ |
1 |
TextRect |
SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) |
Выводит текст, обрезая по границам региона Rect |
6 |
TextOut |
SUB (x%, y%, S$, fc%, bc%) |
Writes text to cell |
5 |
Событие | Тип | Происходит когда... | Параметры |
OnDrawCell | SUB (Col%, Row%, State%, R AS QRect) | Cells need to be redrawn | 4 |
OnEllipsisClick | SUB (Col%, Row%) | Pull down list is clicked | 2 |
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Нажата клавиша | 2 |
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1 |
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | Клавиша отпущена | 2 |
OnListDropDown | SUB (Col%, Row%, BYREF S AS STRING) | Pull down list is clicked. S is a string with items separated by a new line character. | 3 |
OnSelectCell | SUB (Col%, Row%, CanSelect%) | User has selected a cell | 3 |
OnSetEditText | SUB (Col%, Row%, Value$) | User has changed contents of cell | 3 |
QStringGrid Примеры
CREATE Form AS QForm
CREATE Grid AS QStringGrid
Cell(1,1) = "hello"
END CREATE
Center
ShowModal
END CREATE
'------------------------------------------------------------------
' Pulldown list example
$INCLUDE "RAPIDQ.INC"
$ESCAPECHARS ON
CONST AgeList = "10\n11\n12\n13\n14\n15\n16\n17\n18\n19"
SUB EllipsisClick (Col AS LONG, Row AS LONG, Sender AS QSTRINGGRID)
Sender.Cell(Col, Row) = "Comments"+STR$(Row)
END SUB
CREATE Form AS QFORM
CREATE Grid AS QSTRINGGRID
Align = alClient
AddOptions(goEditing)
FixedRows = 1
FixedCols = 0
ColCount = 3
RowCount = 5
DefaultRowHeight = 20
ColumnStyle(0) = gcsList
ColumnStyle(1) = gcsEllipsis
ColumnList(0) = AgeList
Cell(0,0) = " Age"
Cell(1,0) = " Comments"
OnEllipsisClick = EllipsisClick
END CREATE
Caption = "Dropdown list example"
Center
ShowModal
END CREATE