Contents of the TPMDIR.DOC file
TPMDIR.PAS 1:21:24 AM Feb 1, 1990
An example program showing a TpDir-style file pick list with
multiple file selection capability
Copyright January 1990 -- Ken Henderson
Recently a Compuserve user wanted a version of TpDir or a modification
of it to support the selection of multiple files. My response was that
it would not be too difficult, but that TpPick would have to be called
directly, as opposed to indirectly through TpDir.
This program shows a method for doing what the user asked. Just run TESTTPM,
enter a file mask, and you should be able to select multiple files simply
by pressing the bar on the ones you wish to pick. If you wish to
deselect a file, press the bar on it a second time.
The selected files will be shown in a different video attribute than the rest
of the files. Exit the list by pressing or . Once you have
exited, the list of files you have selected will be shown. Note that once
the files are in the ChosenArr, you may do with them what you wish.
The files are loaded into an array of string pointers and are moved to a
secondary array, ChosenArr as you select them, which is resorted each time
you make a selection in order to facilitate the binary search. When you
deselect a file, it's entry in ChosenArr is simply blanked. You will,
therefore, need to test the contents of the elements in ChosenArr before
you do things with them; just check them to see if they are empty.
The key routine in TpMDir is GetFileNameS (note the S). This routine returns
the same codes that TpDir's GetFileName and is, to a large degree, a plug
in replacement for it. Also interfaced is the array of selected files (an array
of string pointers), ChosenArr and a number representing the "highwater mark" of
the number of files selected. This program is just a quickie to show how easy
such a task is given the flexibility of TpPick. BTW, I hear that OpDir allows
this capability, so this little thing may go the way of the buffalo come
Feburary. Oh well, such is life in the software lane.
That's about all there is to TpMdir. The source is provided, but keep in mind
that you will need Turbo Professional from TurboPower Software in order to
This program is distributed as "freeware" and you are under no obligation to
me for using it. I only ask that you leave my copyright notices in tact and
that if you redistribute this software (either by electronic or other means)
you keep the files here together and do not omit any of them.