suggestion handling custom 'save as' in actions framework

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

suggestion handling custom 'save as' in actions framework

Post by toolwiz »

In the actions demo where you add the code to handle saving custom file formats, there's a flag called "success". If it's false, it displays a warning box.

This needs to be a three-valued flag, not a simple true/false flag, because if you hit the Cancel button on the Save dialog, it's neither a success nor a failure. There needs to be a way to return a value like "canceled" or "ignore" or something like that because internally I think that a return of "success=true" does certain things (like resets the flag that says the file has been saved?) while a return of "success=false" doesn't -- but the false value also displays that warning box, which is just not appropriate if you hit the Cancel button. Neither is it appropriate to say "success=true".

-David
Sergey Tkachenko
Site Admin
Posts: 17267
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you mean that the program will ask additional questions to the user before saving, and the user can cancel saving while answering?
In this case, of cause, reading must report failure to the program, but displaying an error message with the list of possible reasons of error is wrong.

Well, for compatibility reasons I do not want to add new parameters to events. Instead, I'll add a new property to TrvActionSave: SuppressNextErrorMessage: Boolean.
In TrvActionSave.OnCustomFileOperation, you can set this property to True, and error message will not be displayed. After that, this property will be reset to False again.
Post Reply