Board index » cppbuilder » TSaveDialog question

TSaveDialog question


2005-05-25 03:37:25 AM
cppbuilder28
I've got a SaveDialog and I'd like to prompt the user when he's about to
overwrite a file. So I set the Options->OverwritePrompt flag to true and
it's ok but an annoying problem arises. Let's say the dialog has a filter
with three entries: "txt", "bla", "kle". And there's a file "name.txt" in
the current dir. So when the user has typed "name.txt" and clicks save, he
receives his warning and everything's ok. But when the user types "name" and
the selected filter item is "txt" he receives no warning which is bad,
because I manually append the extension "txt" to name _after_ the dialog is
closed and thus write to "name.txt" which is undesired. So I have two
questions:
1/ If necessary how to append the extension from the selected finter entry
automatically
just before the dialog closes like, let's say Word does, and see how it's
being
appended for half a second or so?
2/ How to force the Overwrite check to be done _after_ the extension has
been appended and
_before_ the dialog closes?
Seems like a dumb problem but I haven't found a solution yet. Thanks for
your time.
 
 

Re:TSaveDialog question

"Analian" < XXXX@XXXXX.COM >wrote in message
Quote
1/ If necessary how to append the extension from the selected finter
entry automatically just before the dialog closes like, let's say Word
does, and see how it's being appended for half a second or so?
Try using the dialog's OnCanClose or OnClose event.
Quote
2/ How to force the Overwrite check to be done _after_ the
extension has been appended and _before_ the dialog closes?
You cannot. What you can do, however, is use the OnCanClose to format your
filename as needed and then perform the overwrite check manually.
Gabit
 

Re:TSaveDialog question

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Analian" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>1/ If necessary how to append the extension from the selected finter
>entry automatically just before the dialog closes like, let's say Word
>does, and see how it's being appended for half a second or so?

Try using the dialog's OnCanClose or OnClose event.

>2/ How to force the Overwrite check to be done _after_ the
>extension has been appended and _before_ the dialog closes?

You cannot. What you can do, however, is use the OnCanClose to format
your
filename as needed and then perform the overwrite check manually.


Gabit


Thank you, Gambit. The OnCanClose is just the event I needed.
 

{smallsort}