>>GO (RECNO()) IN mitteakt>>line to deleterow method but grid does not refresh.
>>SET TALK off >>set excl off >>set compatible foxplus >>SET SAFETY OFF >>set exact on >>set deleted on >>set udfparms to REFERENCE >> >>SET SYSMENU TO >>SET SYSMENU AUTOMATIC >>DEFINE PAD Action OF _MSYSMENU PROMPT "Action" >>ON PAD Action OF _MSYSMENU ACTIVATE POPUP Action >>DEFINE POPUP Action MARGIN RELATIVE >>DEFINE BAR 1 OF Action PROMPT "Add" KEY CTRL+N, "" >>DEFINE BAR 2 OF Action PROMPT "Delete" KEY CTRL+T, "" >>ON SELECTION BAR 1 OF Action _screen.activeform.addrow() >>ON SELECTION BAR 2 OF Action _screen.activeform.deleterow >> >>CREATE TABLE mitteakt ( klient c(12), toode c(20) ) >>APPEND BLANK >>APPEND BLANK >>use >> >>obrowse1=NEWOBJECT("browse1") >>obrowse1.Show >> >>keyboard '{ctrl+end}{ctrl+T}' >>keyboard '{ctrl+T}' >>keyboard '{ctrl+n}' >>on shutdown onshut() >>READ EVENTS >>return >> >>PROCEDURE onshut >>SET SYSMENU TO defa >>quit >>ENDPROC >> >>************************************************** >>DEFINE CLASS browse1 AS form >> >>ADD OBJECT gridbase1 AS grid WITH ; >> Name = "GridBase1" >> >> PROCEDURE SaveChanges >> TableUpdate(2, .T., 'mitteakt' ) >> ENDPROC >> >> >> PROCEDURE addrow >> thisform.SaveChanges() >> sele mitteakt >> append blank >> REPLACE klient WITH 'hello' >> ENDPROC >> >> PROCEDURE deleterow >> if deleted(thisform.gridbase1.recordsource) >> thisform.gridbase1.refresh() >> return >> endif >> >> sele (thisform.gridbase1.recordsource) >> >> do case >> case recno(thisform.gridbase1.recordsource)>0 >> if cursorgetprop( 'Buffering', thisform.gridbase1.recordsource ) != 1 >> tablerevert(.f., thisform.gridbase1.recordsource ) >> endif >> sele (thisform.gridbase1.recordsource) >> >> delete >> skip >> if cursorgetprop( 'Buffering', thisform.gridbase1.recordsource ) != 1 >> tableupdate(2, .t., thisform.gridbase1.recordsource ) >> endif >> >> if eof() and !bof() >> skip -1 >> endif >> >> case recno(thisform.gridbase1.recordsource)<0 >> >> skip >> if eof() >> skip -1 >> if !bof() >> skip -1 >> endif >> endif >> tablerevert(.t.) >> endcase >> thisform.gridbase1.refresh() >> >>* Following code is added according to Cetin suggestion: >>SELECT mitteakt >>IF RECNO()<0 OR RECNO()<=RECCOUNT() >> GO (RECNO()) IN mitteakt >>ENDIF >> >> ENDPROC >> >> PROCEDURE saverow >> this.SaveChanges() >> ENDPROC >> >> >> PROCEDURE QueryUnload >> this.SaveChanges() >> ENDPROC >> >> >> PROCEDURE Load >> set taLk off >> set multilock Off >>SET TALK off >>set excl off >>set compatible foxplus >>set exact on >>set near on >>set deleted on >>set udfparms to reference >> >> USE mitteakt IN 0 >> ENDPROC >> >> PROCEDURE gridbase1.Init >> set multilock on >> this.recordsource= 'mitteakt' >> cursorsetprop( 'Buffering', 5, this.recordsource ) >> ENDPROC >> >> * Mr. Cetin code to dedect row change. Thanks! >> PROCEDURE gridbase1.BeforeRowColChange >> LPARAMETERS nColIndex >> >> local llChangingRow >> llChangingRow = .f. >> with this >> if mdown() >> local lnBottom, lnTop, lnMouseRowPos >> lnBottom = .top+.headerheight+ .relativerow * .rowheight >> lnTop = m.lnBottom - this.rowheight >> lnMouseRowPos = mrow(wontop(),3) >> llChangingRow = !between( m.lnMouseRowPos, m.lnTop, m.lnBottom) >> if !betw( m.lnMouseRowPos, .top, .top+.height ) >> llChangingRow = .f. >> endif >> else >> local llastke >> llastke = lastkey() >> >> llChangingRow = inlist(lastkey(),24,5,18,3,23, 29) >> endif >> endwith >> >> if m.llChangingRow >> thisform.SaveChanges() >> >> if !betw( recno(this.recordsource), 1, recc(this.recordsource) ) >> nodefault >> go bottom in this.recordsource >> this.setfocus() >> endif >> endif >> ENDPROC >>ENDDEFINE >>>
> endcase > thisform.gridbase1.refresh() > >* Following code is added according to Cetin suggestion: >SELECT mitteakt >IF RECNO()<0 OR RECNO()<=RECCOUNT() > GO (RECNO()) IN mitteakt >ENDIF > > ENDPROC >>With :
> endcase > GO RECNO(thisform.gridbase1.recordsource) ; > IN (thisform.gridbase1.recordsource) > ENDPROC >Cetin,