这个应该不难,表记录指针是可控制的,就算两个表格用同一个表源也可以指向不同的记录。
回复 11楼 吹水佬
现在第一个表不能定位原位置另外请问一下,是不是表单用多了replace后,在grid中就会出现不及时显示的情况,要点击一下才能出来?
[此贴子已经被作者于2016-5-17 23:56编辑过]
** test.prg CREATE CURSOR t1 (f1 I, f2 I) INSERT INTO t1 VALUES (101,102) INSERT INTO t1 VALUES (201,202) INSERT INTO t1 VALUES (301,302) GO TOP CREATE CURSOR t2 (f1 I, f2 I) of = CREATEOBJECT("form1") of.show(1) RETURN DEFINE CLASS form1 as Form height = 350 ADD OBJECT cmd as commandbutton WITH top=10,left=10,height=22,caption="复制" ADD OBJECT grid1 as grid WITH top=40,height=150,width=this.width,; AllowCellSelection=.F.,RecordSource="t1" ADD OBJECT grid2 as grid WITH top=200,height=150,width=this.width,; AllowCellSelection=.F.,RecordSource="t2" PROCEDURE cmd.Click LOCAL mValue[1] SELECT t1 SCATTER TO mValue SELECT t2 APPEND BLANK GATHER FROM mValue thisform.grid2.SetFocus ENDPROC ENDDEFINE
** test.prg IF !FILE("test.dbf") CREATE TABLE test (f1 C(10), f2 C(10)) INSERT INTO test VALUES ("AAA", "1234567890") INSERT INTO test VALUES ("BBB", "1234567801") INSERT INTO test VALUES ("CCC", "1234567012") USE ENDIF USE test ALIAS t1 AGAIN IN 0 USE test ALIAS t2 AGAIN IN 0 of = CREATEOBJECT("form1") of.show(1) RETURN DEFINE CLASS form1 as Form height = 350 ADD OBJECT cmd as commandbutton WITH top=10,left=10,height=22,caption="复制" ADD OBJECT grid1 as grid WITH top=40,height=150,width=this.width,; AllowCellSelection=.F.,RecordSource="t1" ADD OBJECT grid2 as grid WITH top=200,height=150,width=this.width,; AllowCellSelection=.F.,RecordSource="t2" PROCEDURE cmd.Click LOCAL mValue[1] SELECT t1 SCATTER TO mValue SELECT t2 APPEND BLANK GATHER FROM mValue thisform.grid1.Setfocus thisform.grid2.Setfocus ENDPROC ENDDEFINE
[此贴子已经被作者于2016-5-18 10:10编辑过]