$INCLUDE "RAPIDQ.INC"
$ESCAPECHARS ON
$DEFINE K_ESC 27
$DEFINE K_CTRL_Y 25
$DEFINE K_CTRL_I 9
$DEFINE K_CTRL_A 1
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
SUB ShowKey (key AS BYTE, sender AS QSTRINGGRID)
IF key = K_CTRL_Y THEN
IF sender.rowcount > (1+sender.Fixedrows) THEN
sender.deleterow(sender.row)
END IF
ELSEIF key = K_CTRL_I THEN
sender.insertrow(sender.row)
ELSEIF key = K_CTRL_A THEN
sender.rowcount = sender.rowcount + 1
END IF
END SUB
SUB wasAll (key AS BYTE, sender AS QFORM)
IF key = K_ESC THEN
sender.CLOSE
END IF
END SUB
CREATE Form AS QFORM
keyPreview = 1
CREATE Grid AS QSTRINGGRID
Align = alClient
AddOptions(goEditing)
FixedRows = 1
FixedCols = 0
ColCount = 4
RowCount = 10
DefaultRowHeight = 20
ColumnStyle(0) = gcsList
ColumnStyle(1) = gcsEllipsis
ColumnList(0) = AgeList
Cell(0,0) = " Age"
Cell(1,0) = " Comments"
OnEllipsisClick = EllipsisClick
OnKeyPress = showKey
END CREATE
CAPTION = "Inserting and deleting rows"
onKeyPress = wasAll
Center
SHOWMODAL
END CREATE
|