Using the DOSFileLookup control template to let the user pick a folder, or a place to create a new file

Applies to: the DOSFileLookup control template; one thread was posted in the softvelocity.products.c55ee group, the other in softvelocity.public.clarion6. A FileLookup object in the generated code is assumed; the threads name no chain.

Problem

The DOSFileLookup control template lets the user choose an existing file into a variable. The posters wanted the user to choose a data directory instead, or a location where the app will create a new file.

Solution

  1. In the template's own prompts, set the dialog type to Directory (the folder where you want to create the file), Save (select the folder and type a new file name) or Open (pick an existing file). A 2008 poster found this and thanked the helper.
  2. In code: in the Init embed (priority 8800 was given), after the lookup object is set up, add the directory flag: FileLookup.Flags = BOR(FileLookup.Flags,FILE:Directory), using your object's name.
  3. Without the template, call FILEDIALOG with the directory bit (bit 5, value 32 as a bitmap, or FILE:Directory), for example FILEDIALOG('Select a Folder',L:SelectedFolder,,FILE:Directory+File:KeepDir); it returns 0 when cancelled.
  4. To create a missing folder: the C runtime mkdir after INCLUDE('CLIB.CLW') in the global map, or RUN('command /c md test'). CLIB.CLW is in the LibSrc folder of the install; the poster who saw "CLIB.CLW does not exist" was told so.

Caveats

  • The tests were small; only the Directory prompt and the flag were reported to work by the original posters.
  • The mkdir call was shown with a 13-character CSTRING in the thread; size it for your path.

Today (2026)

Not re-tested. The prompt and FILE:Directory flag are likely unchanged; CLIB.CLW naming may differ on current installs.

Sources: Rupert (Feb 2001, the question), Carlos S., Bo S., Eddie S. (Feb 2001) in softvelocity.products.c55ee; David B. (Nov 2008, the question), Ben, Ingasoftplus, Abe J. (Nov 2008) in softvelocity.public.clarion6.