FileName()
USAGE
void FileName(Name, Prompt, Template, Screen, Flags, X, Y)
FUNCTION
This is a powerful file requester that is designed to please everyone. We
hope.
Here are the parameters you pass it:
Name is a byte array into which FileName will deposit the file name the
user selects. If no file is selected, the first byte will be
cleared. This array should be at least 100 bytes long.
Prompt is a null terminated string that is diplayed in the file requester
window's title bar.
Template is a null terminated string that indicates what type of file to
search for and display. For example, if Template were "c", all
files that end with ".c" would be displayed. If you'd rather
display all files, set the template to NULL.
Screen is the screen you'd like the file requester to appear in. If you'd
like it in Workbench, set Screen to NULL. For Bars&Pipes :
functions->screen.
Flags There are several bits you can set to alter the requester's
behavior.
If FILES_DELETE is set, a delete icon will appear, and the user
will be able to delete files, along with selecting
the one to load or save.
If FILE_OPEN is set, an icon that say's 'Open' will replace the
'Okay' icon.
If FILES_SAVE is set, this icon will say 'Save'.
If FILES_TEST is set, the requester will make sure the file can
be opened as required before returning.
So, if FILES_SAVE and FILES_TEST are set, it will try to open the
file for writing before returning. This means, by the way, that the
file will be erased if it can be opened.
If FILES_OPEN and FILES_TEST are set, it will check that the file
can be opened for reading before returning. If the file test fails,
the screen flashes red an the user must make another selection.
X, Y These two numbers indicates the LeftEdge and TopEdge positions for
the file requester. The requester is pretty big (284 x 62), so make
sure it doesn't go off the screen.
The filerequester keeps file name lists around for all the templates it has
received, which makes for fast response. It also means, thought, that they
need to bee released when everthing is done. A call to ReleaseFiles when your
program closes down will do that.
ReleaseFiles is only available in the linkable library. You don't need (or
want) to call it with the AmigaDos Inovatools 1 library, because it can keep
the file directories around for other programs to use. It will call
ReleaseFiles when closes down.
(A remark of A.Faust:
This may be the case in use with Bars&Pipes. I think, because the
ReleaseFiles-function is not integrated in the BlueRibbon.library, Bars&Pipes
does this automatically, when the program ends. But I havn't tested this.
a second remark:
This requester will in Bars&Pipes only work, if in the
Preferences-Menu->Enviroment "WB 2.0 File Requester" is NOT set.)
INPUTS
Name = Character buffer to put file name in (You have to declare it
before) Example: char namebuffer[100];
Prompt = String title for requester
Template = String name of file type to look for, or NULL for all files.
Flags = Mode bits (See above)
Screen = Intuition Screen to put window in. NULL for Workbench.
X, Y = Position in Screen for top and left edge of requester.
RESULT
Returns the file name in the Name buffer. If no file selected, Name[0] == 0.