如果GRID只做显示用(不编辑数据),可以在GRID的click事件中处理
CREATE CURSOR tt (f1 I, f2 I)
FOR i=1 TO 100
INSERT INTO tt VALUES (i, i*2)
ENDFOR
GO TOP
of = CREATEOBJECT("form1")
of.show(1)
RETURN
DEFINE CLASS form1 As Form
ADD OBJECT cmd as commandbutton WITH left=10,top=10
ADD OBJECT Grid1 as Grid WITH left=10,top=30,AllowCellSelection=.F.
PROCEDURE Grid1.click
thisform.cmd.enabled = !thisform.cmd.enabled
ENDPROC
ENDDEFINE
[此贴子已经被作者于2020-6-30 21:13编辑过]