Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to know that CancelNewAndEmpty failed
Message
From
23/11/2001 21:24:41
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
How to know that CancelNewAndEmpty failed
Miscellaneous
Thread ID:
00585303
Message ID:
00585303
Views:
41
I need to execute a specific method when the user cancels the form and is in the middle of adding a record. I have taken the necessary measures to accomplish this except for a couple of events whose approaches to cancel the business object are making it almost impossible. Both cases occur when the user closes the application and the form is still open.

On the first situation, the user closes the application when the cursor contains an new and empty row and the next sequence of events triggers.

CloseAllForms->
Form.QueryUnload-> Form.CancelNewAndEmpty->BizObj.CancelNewAndEmpty
Form.Release-> Form.CleanUp-> Form.CancelNewAndEmpty-> BizObj.CancelNewAndEmpty

This allows to place my call my method at the BizObj.CancelNewAndEmpty. Of curse I need to validate if the cursor has been canceled by the previous call so it does not fire the second time:

if IsAdding('v_MyView')
ThisForm.PGFBIZOBJ.PAGE2.MyClass.MyMethod()
endif

The second situation (see the sequence next):

CloseAllForms->
Form.QueryUnload->
Form.CancelNewAndEmpty->BizObj.CancelNewAndEmpty
Form.AskToSave->Form.Cancel->BizObj.Cancel
Form.Release-> Form.CleanUp-> Form.CancelNewAndEmpty-> BizObj.CancelNewAndEmpty

Does not allow this to happen because the first CancelNewAndEmpty fails without letting you know that it failed:

When it fails lnRetVal = 3 but the statment
lnRetVal = IIF(lnRetVal = FILE_CANCEL, FILE_OK, lnRetVal)
will always set it to FILE_OK

Why??? Return FILE_OK whether it fails or not.

This makes the my method to fire again when the cancel method is reached (which is he least thing I need to happen).

There does not seem to be a way out of this except that I modify my class to keep track of the state. Thus making me work on several other parts of the application.

I do not know how much critical is for the frame to have the CancelNewAndEmpty method always returning FILE_OK but I’ve already spent a whole day trying to solve this the MM way without getting anywhere.

If there is a way around I’ll appreciate that some one would share it with me.

Note: Setting the form to modal only makes thing worst.

Thanks in advance and regards.

Oscar Corte
Next
Reply
Map
View

Click here to load this message in the networking platform