上级表单如何给下一级被调用表单传变量值(非全局变量)?
请问如何实现:表单1里有一个表格grid1,数据来源于一个表,里面的数据是通过APPEN FROM写入表并通过grid1即时显示出来的,通过双击grid1第2行TEXT1事件,打开另一个表单2,并把行号2传给表单2使用?
DO FORM 命令的 WITH 参数
如果打开表单2时表数据记录指针没移动,在表单2直接对表操作就可以。
CREATE CURSOR tt (f1 I, f2 I) FOR i=1 TO 10 INSERT INTO tt VALUES (i, 2*i) ENDFOR GO 3 of = CREATEOBJECT("form1") of.show(1) RETURN DEFINE CLASS form1 as Form ADD OBJECT cmd1 as CommandButton WITH Top=10,Left=10,Height=22,Caption = "form2" PROCEDURE init this.Caption = "当前记录号:"+TRANSFORM(RECNO()) ENDPROC PROCEDURE cmd1.Click of2 = CREATEOBJECT("form2",2) &&相当于 do form form2 with 2 of2.show(1) ENDPROC ENDDEFINE DEFINE CLASS form2 as Form top = 100 left = 100 PROCEDURE init(n) GO n this.Caption = "当前记录号:"+TRANSFORM(RECNO()) ENDPROC ENDDEFINE
CREATE CURSOR tt (f1 I, f2 I) FOR i=1 TO 10 INSERT INTO tt VALUES (i, 2*i) ENDFOR GO 3 of = CREATEOBJECT("form1") of.show(1) RETURN DEFINE CLASS form1 as Form ADD OBJECT cmd1 as CommandButton WITH Top=10,Left=10,Height=22,Caption = "form2" PROCEDURE init this.Caption = "当前记录号:"+TRANSFORM(RECNO()) ENDPROC PROCEDURE cmd1.Click GO 2 of2 = CREATEOBJECT("form2") &&相当于 do form form2 of2.show(1) ENDPROC ENDDEFINE DEFINE CLASS form2 as Form top = 100 left = 100 PROCEDURE init this.Caption = "当前记录号:"+TRANSFORM(RECNO()) ENDPROC ENDDEFINE