>PUBLIC oform1 > >oform1=NEWOBJECT("form1") >oform1.Show >RETURN > >************************************************* > >DEFINE CLASS form1 AS form > > Top = 0 > Left = 0 > Height = 279 > Width = 357 > ShowWindow = 2 > Caption = " ??? Buffering BUGS ???" > nOldRefresh1 = 0 > nOldRefresh2 = 0 > > > ADD OBJECT command1 AS commandbutton WITH ; > Top = 15, Left = 21, ; > Height = 27, Width = 49, ; > Caption = "Input" > > ADD OBJECT label1 AS label WITH ; > Top = 21, Left = 107, ; > Height = 17, Width = 62, ; > Caption = "Invoice No." > > ADD OBJECT text1 AS textbox WITH ; > Top = 17, Left = 173, ; > Height = 23, Width = 74, ; > ControlSource = "test_header.inv_no" > > ADD OBJECT command2 AS commandbutton WITH ; > Top = 15, Left = 288, ; > Height = 27, Width = 49, ; > Caption = "Save", Enabled = .F. > > ADD OBJECT grddetail AS grid WITH ; > Top = 59, Left = 18, ; > Height = 200, Width = 320, ; > RecordSource = "test_detail" > > > PROCEDURE Load > If !file( 'Test_Header.dbf' ) > ** Create table for testing (first time only) > Create table Test_Header ( Inv_No c(8) Candidate ) > Create table Test_Detail ( Inv_No c(8), Descript c(20) ) > Index on Inv_No tag Inv_No > endif > > ** Use Top-Level form and Hide VFP main screen > ** to see the problem (side by side) > _Screen.Visible = .F. > ThisForm.nOldRefresh1 = set( 'Refresh' ) > ThisForm.nOldRefresh2 = set( 'Refresh', 1 ) > Close databases all > > Set MultiLocks on > Set refresh to 0, 90 > Use Test_Header in 1 shared order 1 > Use Test_Detail in 0 shared order 1 > CursorSetProp( 'Buffering', 5, 'Test_Header' ) > CursorSetProp( 'Buffering', 5, 'Test_Detail' ) > Set relation to Inv_No into Test_Detail > ENDPROC > > > Procedure Unload > Close databases all > Set refresh to ThisForm.nOldRefresh1, ThisForm.nOldRefresh2 > _Screen.Visible = .T. > EndProc > > > Procedure GrdDetail.Init > This.Column1.Width = This.Column1.Width + 20 > This.Column2.Width = This.Column2.Width + 20 > EndProc > > > PROCEDURE command1.Click > cInvNo = right( Sys( 2015 ), 8 ) > Insert into Test_Header values ( cInvNo ) > Insert into Test_Detail values ( cInvNo, cInvNo + ', ' + time() ) > Insert into Test_Detail values ( cInvNo, cInvNo + ', ' + time() ) > Insert into Test_Detail values ( cInvNo, cInvNo + ', ' + time() ) > Insert into Test_Detail values ( cInvNo, cInvNo + ', ' + time() ) > > This.Enabled = .F. > ThisForm.Command2.Enabled = .T. > ThisForm.Refresh() > Go -3 in Test_Detail > ThisForm.grdDetail.SetFocus() > ENDPROC > > > PROCEDURE command2.Click > TableUpdate( .T., .T., 'Test_Header' ) > TableUpdate( .T., .T., 'Test_Detail' ) > > This.Enabled = .F. > ThisForm.Command1.Enabled = .T. > ThisForm.Refresh() > ThisForm.Text1.SetFocus() > ENDPROC > >ENDDEFINE >>