Page 1 of 1

More Open-/SaveFileRequester() Flags

Posted: Sat Dec 26, 2009 9:03 am
by nco2k
please add

Code: Select all

#OFN_PATHMUSTEXIST | #OFN_FILEMUSTEXIST to OpenFileRequester()
#OFN_PATHMUSTEXIST | #OFN_OVERWRITEPROMPT to SaveFileRequester()
as default and/or introduce new #PB_Requester_* flags to enable/disable that behavior.

c ya,
nco2k

Re: More Open-/SaveFileRequester() Flags

Posted: Sat Jan 15, 2011 11:53 pm
by C64
I second this request. A future update could allow a "flags" parameter to be added to the end of the SaveFileRequester() command, that defaults to 0; but if specified, passes those flags to the requester. So that on Windows, we can specify the #OFN_OVERWRITEPROMPT flag and not have to do our own "file exists" check after selecting an existing filename. The requester could do the job itself just by adding that flag.

Currently, we have to do this:

Code: Select all

Pattern$ = "Text (*.txt)|*.txt;*.bat|PureBasic (*.pb)|*.pb|All files (*.*)|*.*"
Pattern = 0    ; use the first of the three possible patterns as standard
File$ = SaveFileRequester("Please choose file to save", StandardFile$, Pattern$, Pattern)

;This next block be removed if #OFN_OVERWRITEPROMPT was supported.

savefile=#IDOK

If FileSize(File$)>-1
  msg$="The file you selected already exists."+#CRLF$
  msg$+"Click OK to overwrite it, or Cancel to abort.")
  savefile=MessageRequester("File exists!",msg$,#MB_OKCANCEL)
EndIf

If savefile=#IDOK
  ;Save routine.
EndIf

Re: More Open-/SaveFileRequester() Flags

Posted: Tue Jul 12, 2011 9:55 am
by Michael Vogel
There's another point I miss using the SaveFileRequester function - the automatic adaption of the file extension.

When using wordpad, for example, the save dialog corrects the '.txt' or '.rtf' extension depending on what file extension pattern has been chosen. A 'test.txt' would be automatically changed into 'test.rtf' as soon the user selects the option to use the 'rich text format'.

Re: More Open-/SaveFileRequester() Flags

Posted: Sat Dec 15, 2012 4:18 am
by nco2k
fred any news on this?

c ya,
nco2k

Re: More Open-/SaveFileRequester() Flags

Posted: Sun Jul 22, 2018 11:12 am
by Dude
+1

Re: More Open-/SaveFileRequester() Flags

Posted: Sun Jul 22, 2018 6:10 pm
by Sicro
+1

Re: More Open-/SaveFileRequester() Flags

Posted: Mon Jul 23, 2018 2:37 pm
by RSBasic
+1