Files and Directories

Directory Selector

There is no built-in mechanism in DXL to create a dialog box element for capturing a directory name. This utility function provides you with functionality similar to the fileName perm, except that the selector window allows the user to select a directory rather than a file.

directoryName creates an element inside the specified dialog box for capturing a directory name. This consists of a field for the directory name and a Browse button to invoke a directory selector window. This function can be used in place of fileName whenever you want to capture a directory rather than a file.

Usage:

DBE directoryName(DB box, string label, string initial, bool readOnly)

Example:

#include "directoryName.inc"

DB db
DBE dbe

db = create("Demonstrate Directory Selector")

dbeDirectory = directoryName(db, "c:/Temp", "", false)

realize(db)
show(db)

View source code

Enhanced makeDir Function

Wrapper for mkdir that allows you to create a whole new path, not just a single directory. It also traps and reports errors generated by mkdir.

Usage:

string makeDir(string dirName)

Example:

string errors = ""
errors = makeDir("C:\\Temp\\tom\\dick\\harry")
print errors "\n"

 
View source code