1. Home
  2. /
  3. Docs
  4. /
  5. Articles Report Writer
  6. /
  7. Dialog Components
  8. /
  9. Shell Broswer Dialog Dial...

Shell Broswer Dialog Dialog Control

The Shell Browser Dialog control places a text box with a browse button on a report dialog page. When the user clicks the button, the standard Windows folder browser dialog appears, allowing them to navigate to and select a folder. The selected folder path is stored in the Path property and is available in script throughout the report.

The user can also type a path directly into the text box without using the browse button.


Adding to a Report

Drop a Shell Browser Dialog onto a dialog page. Set Title to give the dialog a meaningful heading, and optionally set Path to a default folder so the dialog opens in a convenient location. The control default size is 200 ร— 22 pixels.


Properties

PropertyTypeDefaultDescription
PathStringThe selected folder path. Updated when the user picks a folder or types directly into the text box. Read this from script to use the selected location.
TitleStringThe heading text shown inside the folder browser dialog above the tree. Leave blank for no heading.
FolderLabelCaptionStringCustom label text shown next to the folder name field at the bottom of the browser dialog

Examples

Reading the selected folder in BeforeStartReport

procedure BeforeStartReport;
begin
  if TrimSafe(ShellBrowserDialog1.Path) = '' then
    RaiseException('Please select a folder before running the report.');

  Report.Variables['OutputFolder'] := ShellBrowserDialog1.Path;
end;

Setting a default starting folder

// Default to the Articles report folder
ShellBrowserDialog1.Path  := GetReportFolder;
ShellBrowserDialog1.Title := 'Select the folder containing your reports';

Using the selected folder to build a file path

procedure BeforeStartReport;
var
  folder   : String;
  filePath : String;
begin
  folder := TrimSafe(ShellBrowserDialog1.Path);
  if folder = '' then
    RaiseException('Please select an output folder.');

  // Ensure there is a trailing backslash
  if RightStr(folder, 1) <> '\' then
    folder := folder + '\';

  // Build a full export path
  filePath := folder + 'SalesReport_' +
              FormatDateTime('yyyymmdd', Date) + '.pdf';

  Report.Variables['ExportPath'] := filePath;
end;

Combining with a Save File Dialog

Use the Shell Browser Dialog to let the user pick a folder, then combine it with a filename to build the full save path.

procedure BeforeStartReport;
var
  folder   : String;
  filename : String;
begin
  folder   := TrimSafe(ShellBrowserDialog1.Path);
  filename := TrimSafe(SaveFileDialog1.FileName);

  if folder = '' then
    RaiseException('Please select an output folder.');

  if RightStr(folder, 1) <> '\' then
    folder := folder + '\';

  Report.Variables['ExportPath'] := folder + filename;
end;

Selecting a data source folder

// Let the user point to a folder containing import files
ShellBrowserDialog1.Title := 'Select the folder containing CSV files to import';
ShellBrowserDialog1.Path  := 'C:\Data\Imports';

// In BeforeStartReport
var importFolder := ShellBrowserDialog1.Path;
if not DirectoryExists(importFolder) then
  RaiseException('The selected folder does not exist: ' + importFolder);

Using Articles system folders as defaults

// Start in the Articles image folder
ShellBrowserDialog1.Path := GetImageFolder;

// Start in the Articles settings folder
ShellBrowserDialog1.Path := GetSettingsFolder;

// Start in the root Articles folder
ShellBrowserDialog1.Path := GetRootFolder;