More Open-/SaveFileRequester() Flags

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

More Open-/SaveFileRequester() Flags

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
C64
Enthusiast
Enthusiast
Posts: 151
Joined: Sat Dec 18, 2010 4:40 am

Re: More Open-/SaveFileRequester() Flags

Post 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
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: More Open-/SaveFileRequester() Flags

Post 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'.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: More Open-/SaveFileRequester() Flags

Post by nco2k »

fred any news on this?

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: More Open-/SaveFileRequester() Flags

Post by Dude »

+1
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 559
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: More Open-/SaveFileRequester() Flags

Post by Sicro »

+1
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: More Open-/SaveFileRequester() Flags

Post by RSBasic »

+1
Image
Image
Post Reply