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.

DarkBASIC Professional Discussion / open file dialog ( Dir$, Filter$, Title$ ), need advice on filter$

Author
Message
DcZee
22
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 15th Sep 2004 08:14
Ive tried a few stabs at it,..like "*.x" and "X File" but i keep coming up with all of the files in the folder,..no filtering happening there. What am i missing?
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 15th Sep 2004 08:21
I haven't tried it, so this is a wild guess:
"DirectX Files|*.X"
(displayed filter name|actual filter)

Play Nice! Play Basic! Out now.

nFinity Emulator. Coming soon.
the_winch
22
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 15th Sep 2004 08:57 Edited at: 15th Sep 2004 08:58
A bit more info that should work. (quote from msdn)

Quote: "For each filtering option, the filter string contains a description of the filter, followed by the vertical bar ( | ) and the filter pattern. The strings for different filtering options are separated by the vertical bar.

The following is an example of a filter string: "Text files (*.txt)|*.txt|All files (*.*)|*.*"

You can add several filter patterns to a filter by separating the file types with semicolons. For example: "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"
"



it's cool to hate
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 15th Sep 2004 09:02
Yes that's where my guess comes from, but I don't know if the dbpro command/functon works the same way. It's very likely though.

Play Nice! Play Basic! Out now.

nFinity Emulator. Coming soon.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 15th Sep 2004 10:07
If this is the OpenFileDialog function in the NetLib plugin then yes follow what the winch quoted.


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
DcZee
22
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 16th Sep 2004 00:46
Awesome and thanks,..knew there was something else to add to this but trapesing through the microsoft cryptic help files to find the answer did not appeal to me. Thanks again!
DcZee
22
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 16th Sep 2004 02:28
Gah I spoke too soon. Its not recognizing the vertical slash and simply displays the entire filter string in the file type area.
A couple of other weirdnesses are:

1. If I place the filter string into a string variable, and use the string variable in the statement, it shows no files in the directory at all, but still displays the strings contents in the file type bar in one line.

2. if i write the filter string directly into the function it displays ALL files with no filtering and the entire filter string is displayed in the file type bar as one continuous line.

It doesnt seem to be parsing the filter string line properly,..so its either a change in how XP handles the dialog box or DBPro expects it in some other format. Unfortunately there are no examples in the help section that shows the open file dialog being used.
the_winch
22
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 16th Sep 2004 03:48 Edited at: 16th Sep 2004 03:52
Which plugin are you using to display the dialog, the enhancement pack one?

The only other way I have seen the string inputed is with null characters instead of pipes ("|") and two null characters at the end of the string.

Try

filter = "DirectX Files"+chr$(0)+"*.X"+chr$(0)+chr$(0)

From msdn
Quote: "lpstrFilter
Pointer to a buffer containing pairs of null-terminated filter strings. The last string in the buffer must be terminated by two NULL characters.

The first string in each pair is a display string that describes the filter (for example, "Text Files"), and the second string specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string.

The system does not change the order of the filters. It displays them in the File Types combo box in the order specified in lpstrFilter.

If lpstrFilter is NULL, the dialog box does not display any filters.

Windows XP: In the case of a shortcut, if no filter is set, GetOpenFileName and GetSaveFileName retrieve the name of the .lnk file, not its target. This behavior is the same as setting the OFN_NODEREFERENCELINKS flag in the Flags member. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0"."



it's cool to hate
DcZee
22
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 17th Sep 2004 07:26
Thanks winch,..Ill give that a try asap. Im using the enhancement pack open file dialog command.
DcZee
22
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 17th Sep 2004 07:42
It must be a special format,..unrelated to windows filter$ cause none of the filters ive tried work. If I use a string variable then the dialob comes up completely blank with no files in it at all. I have to place a quoted string into that position in the command to even get files to display. For now im using "DirectX Files" and that at least brings up all the files in the directory.
Ill send tgc a message and see if i can get some clarification on that command. Thanks for the help,...

Login to post a reply

Server time is: 2025-06-03 18:18:45
Your offset time is: 2025-06-03 18:18:45