Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange cListObjEditForm behavior
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00395271
Message ID:
00407893
Views:
28
Yeah Baby!

Your mods work like a charm. I don't know the other mere mortals around here think, but you have my blessing to include it in the next framework release.

I suggest you run this by the oRox in case she has any "icks" to add. ;-)

oIck.release()



>Alex,
>
>The reason you're experiencing this is because your cursor is table buffered. When you click the Cancel button in the edit form, CListObjEdit is sending a cancel() message to the business object which removes the record from the cursor!
>
>I thought about this and came up with the following solution that works for both row and table buffered cursors...let me know how this works for you:
>
>1. Add a new method to KBizObj called SaveFieldValues() that contains the following code:
>
>LOCAL loSelect
>
>loSelect = CREATE('CSelect', This.GetAlias())
>IF NOT PEMSTATUS(This, "oValues", 5)
> This.AddProperty("oValues")
>ENDIF
>SCATTER NAME This.oValues MEMO
>
>2. Add another new method to KBizObj called RestoreFieldValues() that contains the following code:
>
>LOCAL lcAlias, lnField, lnFldCnt, lcCmd
>
>lcAlias = This.GetAlias()
>
>lnFldCnt = FCOUNT(lcAlias)
>FOR lnField = 1 TO lnFldCnt
> lcField = FIELD(lnField, lcAlias)
> IF NOT EVAL(lcAlias + "." + lcField) == EVAL("This.oValues."+lcField)
> lcCmd = "REPLACE " + lcField + " WITH " + "This.oValues." + ;
> lcField + " IN " + lcAlias
> &lcCmd
> ENDIF
>ENDFOR
>
>3. Change CListObjEdit.cmdEdit.Click() as follows:
>
>Change...
>llRetVal=DoForm(THIS.Parent.cEditForm,.F.,ThisForm,This.Parent.oBizObj)
>
>IF NOT llRetVal
> *-------------------------------------
> *--- The user selected Cancel in the
> *--- CListObjEditForm. Cancel any
> *--- edits to the record
> *-------------------------------------
> This.Parent.oBizObj.Cancel()
>ENDIF
>
>To...
>*----------------------------------
>*--- Save the original field values
>*----------------------------------
>This.Parent.oBizObj.SaveFieldValues()
>
>*--------------------------------------------
>*--- Edit the currently highlighted record
>*--- Indicate EDIT mode, pass a reference
>*--- to this form and the list object.
>*--------------------------------------------
>llRetVal=DoForm(THIS.Parent.cEditForm,.F.,ThisForm,This.Parent.oBizObj)
>
>IF NOT llRetVal
> *-------------------------------------
> *--- Restore the original field values
> *-------------------------------------
> This.Parent.oBizObj.RestoreFieldValues()
>ENDIF
>
>
>Regards,
Low-carb diet not working? Try the Low-food diet instead!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform