Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Clistobjedit - Deleting records programmatically
Message
 
À
24/08/2000 10:34:38
Gerald McKinsey
Keystone Consulting Services, Inc.
Yorktown, Indiana, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00408580
Message ID:
00408874
Vues:
17
Hi Dustin

I decided to take one step back and basically trace what a listobj did when you added a new record through the ADD button.

Turns out that after adding the record to the view, the save() method of the bizobj is called and the record is actually saved.

I thought that the record stayed solely on the view until you saved the FORM.

I added a call to the save method in my code and now it works well.

It's possible that if you cancel the form itself those newly added records are in turn deleted; I'll look into this later, but for now at least I think I finally nailed it.

Thanks!

alex



>> * First attempt using delete
>> * This.Parent.Parent.Page2.cMoneyListObj.CListObj1.delete()
>
>Are you using your own business object to populate the grid, or the built in one that comes with cListObjEdit?
>
>Either way, you need to call the BizObj's delete method. Looks like you were calling one of the components of the grid. How about:
>
>This.Parent.Parent.Page2.cMoneyListObj.oBizObj.Delete()
>This.Parent.Parent.Page2.cMoneyListObj.cListObj1.grdList.Refresh()
>
>Deleting records of a view of a dataenvironment of a business object should go through the business object (then all the rules can be enforced). And then refresh the grid.
>
>If you peek inside Kevin's code for the cListObjEdit's Delete button's Click method, you see that he makes a backup copy of the Form's Primary BizObj, puts the grid's bizobj up there, and then call ThisForm.Delete().
>Why? What does ThisForm.Delete() do that BizObj.Delete() doesn't do?
>Here's the code:
>
>IF llFormIsPresent
>
>        This.Parent.PreDeleteHook()
>       	loTempObject = ThisForm.oBizObj
>       	ThisForm.oBizObj = This.Parent.oBizObj
>       	lnRetVal = ThisForm.Delete()
>	ThisForm.oBizObj = loTempObject
>	IF lnRetVal = FILE_OK
>		This.Parent.CListObj1.grdList.Refresh()
>		This.Parent.CListObj1.grdList.SetFocus()
>	ENDIF
>
>	THISFORM.WaitMode(.F.)
>	ThisForm.LockScreen = .F.
>
>	This.Parent.PostDeleteHook()
>
>ENDIF
Low-carb diet not working? Try the Low-food diet instead!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform