Multiple file mask options w/ FileSaveBox & FileOpenBox

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Locked
smokinbanger
Posts: 204
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Multiple file mask options w/ FileSaveBox & FileOpenBox

Post by smokinbanger »

The Help file has some basic information about the FileSaveBox & FileOpenBox commands but doesn't really indicate any multiple file mask options. When file masks are implemented according to the help file, the drop down box on the File Open and file Save dialogs will only have one (1) file extension type listed. However there may be times you wish to allow the user to select from one of multiple file types/extensions, i.e. image file extentions .jpg, .png, or .bmp. So after doing a little trial and error here is what I came up with; you can mask the selection to multiple extension by seperating the extensions with a semicolon ( ; ). Also to add additional selection options to the drop down box at the bottom of the File open and Save dialog boxes, use a another pipe charactor (|) and enter another selection option following it. Here are a few examples, try them out:

Code: Select all

FileSaveBox "Select Desktop Background File" "Image File (*.bmp, *.gif, *.jpg, *.png, *.tif)|*.bmp;*.gif;*.jpg;*.png;*.tif|PNG File (*.png)|*.png|Jpeg File (*jpg)|*.jpg|Text File (*.txt, *.rtf)|*.txt;*.rtf|Any File|*.*" "" "[filesave]"

Code: Select all

FileOpenBox "Select Desktop Background File" "Image File (*.bmp, *.gif, *.jpg, *.png, *.tif)|*.bmp;*.gif;*.jpg;*.png;*.tif|PNG File (*.png)|*.png|Jpeg File (*jpg)|*.jpg|Text File (*.txt, *.rtf)|*.txt;*.rtf|Any File|*.*" "" "[fileopen]" ""
Good luck!
User avatar
dec
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain
Contact:

Post by dec »

Hello,

In fact you found the standard Windows way to define the standard open and save file dialogs "Filter" property, as you can read, for example, in this documentation. If you wanted other options, like specify the "filter index" and others, take a look at the npOpenFileDialog action from my npUtil plugin. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
smokinbanger
Posts: 204
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Post by smokinbanger »

dec wrote:Hello,

In fact you found the standard Windows way to define the standard open and save file dialogs "Filter" property, as you can read, for example, in this documentation.
Leave it to me to figure it out the hard way :roll:
dec wrote:If you wanted other options, like specify the "filter index" and others, take a look at the npOpenFileDialog action from my npUtil plugin. ;)
Reordering the filter mask will set the order shown in the dialog, the first will be default, however it won't return the filter index.
User avatar
dec
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain
Contact:

Post by dec »

Hello,
smokinbanger wrote:Leave it to me to figure it out the hard way :roll:
I can remember my hard way days on this too. Because this I write on this post. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
David de Argentina
Posts: 1596
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina
Contact:

Post by David de Argentina »

smokinbanger
Posts: 204
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Post by smokinbanger »

David de Argentina wrote:http://www.neosoftware.com/forum/viewtopic.php?t=16386

search link is impressive !!! ;-)
Like I said:
smokinbanger wrote:Leave it to me to figure it out the hard way :roll:
I think it would be a good idea to have an online version of the help documentaion that could be updated with these small tips occasionally. It would be very simple. Even a wiki version. 8) I could also see a cool little app that could automatically update the local version on your PC from the official online version :idea: I could see how this would be very useful as I can think of a couple dozen tips n tricks native to Neobook that are not mentioned in the help doc. Then the only trick would be to get people like me to actually READ it! :lol:
User avatar
dec
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain
Contact:

Post by dec »

smokinbanger wrote: Then the only trick would be to get people like me to actually READ it! :lol:
:D
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Post by dpayer »

dec wrote:
smokinbanger wrote: Then the only trick would be to get people like me to actually READ it! :lol:
:D

You know, if I focus elsewhere for a couple months and then try to code something, my brain is like jelly :)

I need to re read the entire helpfile again to get reoriented!

D
smokinbanger
Posts: 204
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Post by smokinbanger »

dpayer wrote: You know, if I focus elsewhere for a couple months and then try to code something, my brain is like jelly :)

I need to re read the entire helpfile again to get reoriented!

D
That sounds a bit familiar! :lol:
Locked