FileExists event
Description
Occurs when a file is saved in the RichTextEdit control and
the file already exists.
Event ID
|
Event ID |
Objects |
|---|---|
|
pbm_renfileexists |
RichTextEdit |
Parameters
|
Argument |
Description |
|---|---|
|
filename |
The name of the file |
Return Values
Long. Return code choices (specified
in a RETURN statement):
-
0 Continue
processing -
1 Saving of document is canceled
Usage
The SaveDocument function can trigger the
FileExists event.
Examples
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:
|
1 |
integer li_answer |
|
1 |
|
1 |
// If user asked to Save to same file, |
|
1 |
// do not prompt for overwriting |
|
1 |
IF ib_saveas = FALSE THEN RETURN 0 |
|
1 |
|
1 |
li_answer = MessageBox("FileExists", & |
|
1 |
   filename + " already exists. Overwrite?", & |
|
1 |
      Exclamation!, YesNo!) |
|
1 |
   MessageBox("Filename arg", filename) |
|
1 |
|
1 |
// Returning a non-zero value cancels save |
|
1 |
IF li_answer = 2 THEN RETURN 1 |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest