Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Doing a partial save
Message
From
25/08/2000 18:14:20
Gerald McKinsey
Keystone Consulting Services, Inc.
Yorktown, Indiana, United States
 
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00409443
Message ID:
00409472
Views:
19
I hope someone has a better answer. (Like a property to turn on or off!)
But if not...
The secret is to look at what he does in the save button. And then to write your own save code. It used to look like it did an infinite number of things, but now that we understand it, there really is only a handful and a half of things that have to happen.

I'll show some code we did that let us edit a record on the same page as a cListObjEdit, so don't use it line for line!

Hopefully, if you peek at this code, and the foundation save code in your instance, you'll see the 5 or 6 things that must happen when you write your own SaveButton.Click() code. Just do what he does, but not the "set focus to first pageframe"

Dustin

--------------------
IF NOT ThisForm.lKeyNewMode
   * Save changes (edit mode)
   If ThisForm.PreSaveHook()
      * Checks to see if there are 'mustkey fields', and then enforce them.
      If ThisForm.lCheckMustKey
         loObject = ThisForm.MustKeyEntered(ThisForm)
         If Type("loObject") == "O"
            loObject.SetFocus()
            Return
         EndIf
      EndIf
      lcSelect = CREATEOBJECT("cSelect", This.Parent.oBizObj.GetAlias())
      If CURSORGETPROP("BUFFERING") != DB_BUFOPTTABLE
         If This.Parent.oBizObj.Save() = FILE_OK
            ThisForm.PostSaveHook()
         Else 
            ThisForm.DisplayBrokenRules(This.Parent.oBizObj)
         EndIf
      Else
         This.Parent.oBizObj.lNoRecords = .F.
      EndIf
   EndIf
   ThisForm.KEYLISTOBJEDIT1.CListObj1.grdList.Refresh()
   ThisForm.KEYLISTOBJEDIT1.CListObj1.grdList.SetFocus()
   ThisForm.KEYLISTOBJEDIT1.PostEditHook()
ELSE
   && Appended (new) record with changes
   If ThisForm.PreSaveHook()
      * Checks to see if there are 'mustkey fields', and then enforce them.
      If ThisForm.lCheckMustKey
         loObject = ThisForm.MustKeyEntered(ThisForm)
         If Type("loObject") == "O"
            loObject.SetFocus()
            Return
         EndIf
      EndIf
      lcSelect = CREATEOBJECT("cSelect", This.Parent.oBizObj.GetAlias())
      If CURSORGETPROP("BUFFERING") != DB_BUFOPTTABLE
         If This.Parent.oBizObj.Save() = FILE_OK
            ThisForm.PostSaveHook()
            ThisForm.KEYLISTOBJEDIT1.SetButtonEnabledStatus()
            *Refreshall happens to clear out broken rules. Changed to refresh()
            *ThisForm.KEYLISTOBJEDIT1.CListObj1.grdList.RefreshAll()
	    ThisForm.KeyListObjEdit1.cListObj1.grdList.Refresh()
	    ThisForm.KEYLISTOBJEDIT1.CListObj1.grdList.nRecNo = RECNO()
	    ThisForm.KEYLISTOBJEDIT1.CListObj1.grdList.SetFocus()
         Else 
	    ThisForm.DisplayBrokenRules(This.Parent.oBizObj)
         EndIf
      Else
         This.Parent.oBizObj.lNoRecords = .F.
      EndIf
   EndIf	
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform