How do I prevent the users from clicking File-Save on the menu… and force them to use command buttons I created?
Subject: Hiding File/Save
If you must here is 1 way:
However, doing this is not recommended because you are preventing the use of normal UI actions that people like to use. You’d be much better off using the QuerySave or PostSave form events which will execute your code no matter how the user chooses to save a document.
Subject: Quite frankly, you don’t
And how are you going to prevent the use of , and <Ctrl+S> keystrokes to save the document? As other posters have pointed out, the client event model provides ways to work with the user, not against them, by hooking into QuerySave and other events.
Subject: Hiding File/Save
Well, if you REALLY want them to use the button instead of moving the code in the button to the QuerySave event.
Then you can have hidden field on the form, e.g. allowtosave that is set to 0.
In your QuerySave you have code near the beginning that says (check spelling of methods, etc)
if source.fieldgetText(“AllowSave”) = “0” then
MsgBox(" You must use the save action button")
continue = False
End if
Then in your action button you have
Field AllowToSave := “1”;
I think it’s better to move the code to the querysave event because it’s much more standard and then can handle the actions: file > save, control-s, escape and answer Yes to the save prompt, and the smart icon.