Search code examples
visual-foxpro

How to replace Discard changes with Do you want to save changes


If Esc key is pressed in

MODIFY FILE test

window, Visual FoxPro shows

Discard changes

Yes No

prompt. How can I replace this with

Do you want to save changes to test.txt

Yes No Cancel

prompt ?

A Yes/No/Cancel prompt appears if I click on the close button in the upper right corner of the close window.

Is it possible to force it to appear when I press ESC also ?

Can ON KEY LABEL esc or some custom edit windows command be used or is there some other solution ?


Solution

  • Yes, you could solve it with ON KEY LABEL esc someFunctionCall(). The function has then to display the dialog you desire, and you also have to write the logic whether you pressed Yes, No or Cancel. Also keep in mind, that you have to issue ON KEY LABEL esc again, so the dialog won't show up everywhere.

    Another solution would be hitting CTRL+S before you press Escape. With another dialog you have to move the mouse or press another button anyways, so there is no time to safe here.