用GRID列表选择示例:
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
** test.prg
CREATE CURSOR tt (f1 C(3), f2 C(3), f3 C(3))
FOR i=1 TO 9
INSERT INTO tt VALUES (TRANSFORM(110+i), TRANSFORM(120+i), TRANSFORM(130+i))
ENDFOR
GO TOP
of = CREATEOBJECT("form1")
of.show(1)
DEFINE CLASS form1 as form
caption = "点击选取"
ADD OBJECT grid1 as grid WITH AllowCellSelection=.F.,DeleteMark=.F., RecordMark=.F.,;
SplitBar=.F.,HeaderHeight=0,RowHeight=50,HighlightForeColor=0,HighlightBackColor=0xFFFFFF
PROCEDURE _GridMouseDown(nButton, nShift, nXCoord, nYCoord)
LOCAL nWhere, nRelRow, nRelCol
nWhere
= 0
nRelRow = 0
nRelCol = 0
IF this.grid1.GridHitTest(nXCoord, nYCoord, @nWhere, @nRelRow, @nRelCol)
IF nWhere == 3
this.grid1.ActivateCell(nRelRow, nRelCol)
this.Caption = "点击选取了 "+TRANSFORM(this.grid1.Columns[nRelCol].Text1.Value)
ENDIF
ENDIF
ENDPROC
PROCEDURE grid1.init
this.setall("alignment", 2, "column")
this.setall("width", 50, "column")
BINDEVENT(this, "MouseDown",
thisform, "_GridMouseDown")
ENDPROC
ENDDEFINE