Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Save Dialog (DBP) (Enhancements Expansion Pack)

Author
Message
Mirthin
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Land of the Rising Haggis
Posted: 18th Oct 2006 20:07
Hi there.

I'm having trouble with the Open File Dialog function. I can call it, and it returns a variable for the file, but if I put anything into the filter string, I get nothing in the directory that I'm viewing, apart from folders. The help file seems a bit brief and there seems to be no example.

This is what it says in the help file...

Quote: "OPEN FILE DIALOG
Displays a standard Windows open file dialog box. The "Dir$" parameter specifies the directory that the dialog box will display. The "Filter$" parameter can be set to control which file types are display. The "Title$" parameter sets the window title of the dialog box. The string returned is the name of the selected file.

SYNTAX
return string = OPEN FILE DIALOG( Dir$, Filter$, Title$ )
"


However, I don't know exactly what to put into the filter. I've tryed "sav", ".sav", "*.sav", "(*.sav)" and so on, but no luck. If I leave the filter string blank, it shows all files, and the file type box is blank, but if I add anything to the filter, I get a strange list of strings.

If I run it in the IDE, I get something like in picture on the left (attatched). If I compile it and run the EXE, I get some of the variables that are lying elsewhere in my program (see right part of picture)!

It's probably me who's gone wrong somewhere, but I wish I could help myself. I'm sorry to bother anyone, and thank you very much for reading this far.

Attachments

Login to view attachments
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 19th Oct 2006 06:24 Edited at: 19th Oct 2006 13:04
edit

see below.

Dark Physics makes any hot drink go cold.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 19th Oct 2006 11:14 Edited at: 19th Oct 2006 11:14
Firstly there seems to be some confusion about which dialog you are using. You seem to be wanting to save but you are showing the OPEN FILE DIALOG help file. Perhaps you should try the SAVE FILE DIALOG.
As for the filter parameter is to define which file types you want to be able to save as (or load if using OPEN FILE DIALOG). You need a description and a suffix for each file type you want to use and then seperate each with a pipe character.
So, let's say for example you wanted to be able to save PNG files or BMPs ONLY. The filter parameter would look like this:

"PNG files|*.png|Bitmap files|*.bmp"

... or another example. You want to save text files or any type of file.

"Text files|*.txt|All files|*.*"


Mirthin
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Land of the Rising Haggis
Posted: 20th Oct 2006 19:08 Edited at: 20th Oct 2006 19:29
Oops, yes, I've been using the save file dialog function in my code, but grabbed the wrong definition from the manual. My bad.

Thanks a lot for helping me out, but I still can't get it to work. I'm literally typing into the filter string "Save Files|*.sav", and although those strange other filter options are gone, it still isn't filtering properly. It's as if I've put in "All Files|*.*", because I can see every type of file in the directory.

EDIT: I've found a function made by Jess T. I'm going to try that to see if it works...

EDIT 2: Yep, works perfectly. Thanks again for all your help.

Login to post a reply

Server time is: 2024-11-27 05:44:17
Your offset time is: 2024-11-27 05:44:17