Occurs when a file is saved in the RichTextEdit control and the file already exists.
Event ID |
Objects |
---|---|
pbm_renfileexists |
RichTextEdit |
Argument |
Description |
---|---|
filename |
The name of the file |
Long. Return code choices (specified in a RETURN statement):
0 Continue processing
1 Saving of document is canceled
The SaveDocument function can trigger the FileExists event.
This script for FileExists checks a flag to see if the user is performing a save (which will automatically overwrite the opened file) or wants to rename the file using Save As. For the Save As case, the script asks the user to confirm overwriting the file:
integer li_answer
// If user asked to Save to same file,
// do not prompt for overwriting
IF ib_saveas = FALSE THEN RETURN 0
li_answer = MessageBox("FileExists", &
filename + " already exists. Overwrite?", &
Exclamation!, YesNo!)
MessageBox("Filename arg", filename)
// Returning a non-zero value cancels save
IF li_answer = 2 THEN RETURN 1