How can I open a better file requester?

BlitzPlus Forums/BlitzPlus Programming/How can I open a better file requester?

sswift(Posted 2005) [#1]
The file requester in Blitzplus leaves something to be desired.

If you want the window to display more than one file format at once, you can't. If you specify more than one file extension, seperating them with commas, then it selects the first one when the doalog box opens, and only those files are visible, and the only way for the user to see the other fiels they could load is by manually selecting each format from the combobox below.

There is also no way to combine multipler extensions next to one another and give them a name like "Jpeg" or "Targa".

I'm thinking it must be possible to open your own file requester to bypass the one in Blitz.


Kuron(Posted 2005) [#2]
BlitzUI has its own requester as does XLNTii and I beelieve there are a couple in the code archives. Also there are probably some old ones floating around for B2D that could be converted.


Beaker(Posted 2005) [#3]
For a slight improvement try this:
file$ = RequestFile("Select a file","jpg;*.bmp;*.png,*")

SR - I think you are missing the point a little.


Beaker(Posted 2005) [#4]
I've improved the docs a little here:
http://www.blitzbasic.com/bpdocs/command.php?name=RequestFile&ref=gui_cat


sswift(Posted 2005) [#5]
I did fidn this code archives entry:
http://www.blitzbasic.com/codearcs/codearcs.php?code=916

But it is for Blitz3D, and crashes in Blitzplus for some reason, even when debugging.

Also the code is just way too complicated for my tastes for such a seemingly simple task. :-)

I also found this info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnima01/html/ima1101.asp

I can't really read a lot of that cause it's in C++, but this bit stood out:
lngResult = cdlg.OpenFileDialog(lngFormHwnd, _
lngAppInstance, strInitDir, strFileFilter)

It appears to indicate that none of the parameters involve bytes at all, just longints and strings, so I'm not sure why the code archives example was poking all this data into a bank... Maybe at some point Mark changed how DLL's were accessed? I don't know.

I'll take a look at that example you posted now Beaker, it might be good enough for my needs.


Beaker(Posted 2005) [#6]
If you want something that does more then let me know and I will knock together a little DLL.


sswift(Posted 2005) [#7]
Hm... I guess that'll be good enough for my needs. Being able to do more with it would be nice, but it's not worth spending lots of time trying to figure out how to replace * in the combobox with "All Files *.*"

Thanks Beaker. :-)


JoshK(Posted 2005) [#8]
[EDITED BY MOD: the code below isn't Blitz code - its PureBasic]
Global svar.s

ProcedureDLL.l pbSaveFileRequester(Title$,DefaultFile$,Pattern$,PatternPosition) 
svar.s=SaveFileRequester(Title$,DefaultFile$,Pattern$,PatternPosition) 
ProcedureReturn @svar.s
EndProcedure

ProcedureDLL.l pbOpenFileRequester(Title$,DefaultFile$,Pattern$,PatternPosition) 
svar.s=OpenFileRequester(Title$,DefaultFile$,Pattern$,PatternPosition) 
ProcedureReturn @svar.s
EndProcedure

ProcedureDLL.l pbSelectedFilePattern() 
ProcedureReturn SelectedFilePattern()
EndProcedure



sswift(Posted 2005) [#9]
Is that C? What is that?

No... that can't be C, there's none of those stupid brackets. Is that Purebasic? I know you love your Purbasic...

Wait I think I know... That's Blitzmax isn't it?

I don't have Blitzmax!

But I thought you might have something like this Halo, because one of your programs I ran across while searching the forums for a solution had these functions to open file dialogs that had the same names as the BlitzPlus functions, but they had parameters that the Blitzplus ones didn't support.


Lattyware(Posted 2005) [#10]
I noted this somewhere... A preview area for images would have been great too...