Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clistobjedit - Deleting records programmatically
Message
From
24/08/2000 10:34:38
Gerald McKinsey
Keystone Consulting Services, Inc.
Yorktown, Indiana, United States
 
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00408580
Message ID:
00408739
Views:
15
> * 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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform