>>>Hi everybody,
>>>
>>>I need to implement the following functionality:
>>>
>>>Cancel button (and clicking on the Close x button at the top of the form will prompt in case of unsaved changes and let the user to save them or really close/cancel – note, this behavior is non-standard to other application forms where Cancel just cancels without any prompts).
>>>>>>So, this is the question I added (see attached), but I am not sure I like it. I am wondering how should I phrase this prompt question - can you please suggest?
>>>
>>>Thanks in advance.
>>
>>The user may have hit the close by accident
>>
>>I'd go for Save changes : Yes - No - Cancel with the default on the Cancel button
>>
>>yes = save and exit
>>No: disregard changes and exit
>>
>>Cancel : disregard the Close x and continue whatever I was doing
>
>I was looking for the exact wording. This is what I currently have but I don't like it also as right now the Yes and No are reverse. I can leave it like this and let the tester tell me if it's OK or not and how to change it or keep playing with it:
>
>
>if vartype(m.tcMode) = 'C' and m.tcMode = 'Close'
> lcQuestion = " Do you really want to close this form without saving?"
> else
> lcQuestion = "You have unsaved changes. Do you really want to cancel them?"
> endif
> if messagebox(m.lcQuestion,4 + 32 + 256, 'Cancel Changes') = 7
> if not thisform.save()
> llReturn = .f.
> nodefault
> endif
> else
Capture the return value of the messagebox (yes, no, cancel)
returnvalue = messagebox('Save changes',3 + 32 + 512, 'You have unsaved changes')
Gregory