- Main Page
- Packages
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# smjg.libs.sdwf.commondialog.FileDialog Class Reference

The smjg.libs.sdwf.commondialog.FileDialog class wraps the Open and Save As common dialogs. More...

Inheritance diagram for smjg.libs.sdwf.commondialog.FileDialog:

List of all members.

## Public Member Functions
| this (WindowBase p, string[2][] flt, string defaultExtension)
| Construts a new FileDialog.
char[] | showOpen ()
| Displays the dialog box to open a file.
char[] | showSave ()
| Displays the dialog box to save a file.
Properties
void | filters (string[2][] flt)
| The filename filters to display in the "Files of type" or "Save as type" drop-down list.
void | openFilters (string[2][] flt)
| The filename filters to display when opening a file.
void | saveFilters (string[2][] flt)
| The filename filters to display when opening a file.
char[] | filePath ()
string | filePath (string fp)
char[] | fileName ()
string | fileName (string fp)
## Public Attributes
OFN | openFlags
| Flags to use when opening a file. Default is OFN.TYPICAL_OPEN.
OFN | saveFlags
| Flags to use when saving a file. Default is OFN.TYPICAL_SAVE.
char[] | openFilterString
| Internal representation of the filter list to use when opening a file.
char[] | saveFilterString
| Internal representation of the filter list to use when saving a file.
uint | _structSize = OPENFILENAMEA.sizeof
HWND | _parentHandle = null
HINSTANCE | _instanceHandle = null
LPCTSTR | _filters = null
LPTSTR | _customFilter = null
uint | _maxCustomFilterLength = 40
uint | filterIndex = 1
| One-based index of selected filter, or zero if a custom filter has been specified.
LPTSTR | _filePath = null
uint | _maxFilePathLength = 260
LPTSTR | _fileName = null
uint | _maxFileNameLength = 260
LPCTSTR | _initialDir = null
LPCTSTR | _dialogTitle = null
OFN | flags = cast(OFN) 0
| A bitwise combination of flags to customise the file dialog.
ushort | _fileNameOffset = 0
ushort | _fileExtensionOffset = 0
LPCTSTR | _defaultExtension = null
uint | _customHookData = 0
LPOFNHOOKPROC | _hookFunction = null
LPCTSTR | _templateName = null
OPENFILENAMEA | spec
| This dialog specification as a Windows OPENFILENAMEA structure.
## Static Protected Member Functions
static char[] | filterString (string[2][] flt)

## Detailed Description

The smjg.libs.sdwf.commondialog.FileDialog class wraps the Open and Save As common dialogs.

The same FileDialog instance can be used for both purposes, meaning that such things as the current filename and certain parameters can remain synchronised.

Bug:
  The resizing widget tends to have a hole in the edge, at least under Windows 98SE. I have as yet been unable to figure out why.

Todo:
  support multiple selection

## Constructor & Destructor Documentation

smjg.libs.sdwf.commondialog.FileDialog.this | ( | WindowBase | p,
|  | string | flt[2][],
|  | string | defaultExtension |
| ) |  |  |

Construts a new FileDialog.

Parameters:

  | p | the parent window of the dialog.
  | flt | the list of file filters. See the FileDialog.filters property.
  | defaultExtension | the extension that will be automatically applied to filenames if omitted, excluding the '.' character.

## Member Function Documentation

char [] smjg.libs.sdwf.commondialog.FileDialog.showOpen | ( |  | ) |

Displays the dialog box to open a file.

Returns:
  the full pathname of the requested file, or `null` if the operation was cancelled.

char [] smjg.libs.sdwf.commondialog.FileDialog.showSave | ( |  | ) |

Displays the dialog box to save a file.

Returns:
  the full pathname by which the file is to be saved, or `null` if the operation was cancelled.

void smjg.libs.sdwf.commondialog.FileDialog.filters | ( | string | flt[2][] | ) |

The filename filters to display in the "Files of type" or "Save as type" drop-down list.

Each element of this array specifies a filter. For each filter, the first element is the textual description of the filter, and the second is the wildcard pattern.

Setting this property is equivalent to setting FileDialog.openFilters and FileDialog.saveFilters simultaneously. Separate FileDialog.openFilters and FileDialog.saveFilters properties are also provided in case an application can read file formats that it cannot save, or (less commonly) vice versa.

This property, FileDialog.openFilters and FileDialog.saveFilters are currently write-only, although you can read the internal representation in FileDialog.openFilterString and FileDialog.saveFilterString.

void smjg.libs.sdwf.commondialog.FileDialog.openFilters | ( | string | flt[2][] | ) |

The filename filters to display when opening a file.

void smjg.libs.sdwf.commondialog.FileDialog.saveFilters | ( | string | flt[2][] | ) |

The filename filters to display when opening a file.

char [] smjg.libs.sdwf.commondialog.FileDialog.filePath | ( |  | ) |

string smjg.libs.sdwf.commondialog.FileDialog.filePath | ( | string | fp | ) |

char [] smjg.libs.sdwf.commondialog.FileDialog.fileName | ( |  | ) |

string smjg.libs.sdwf.commondialog.FileDialog.fileName | ( | string | fp | ) |

static char [] smjg.libs.sdwf.commondialog.FileDialog.filterString | ( | string | flt[2][] | ) | `[static, protected]`

## Member Data Documentation

uint smjg.libs.sdwf.commondialog.FileDialog._structSize = OPENFILENAMEA.sizeof

HWND smjg.libs.sdwf.commondialog.FileDialog._parentHandle = null

HINSTANCE smjg.libs.sdwf.commondialog.FileDialog._instanceHandle = null

LPCTSTR smjg.libs.sdwf.commondialog.FileDialog._filters = null

LPTSTR smjg.libs.sdwf.commondialog.FileDialog._customFilter = null

uint smjg.libs.sdwf.commondialog.FileDialog._maxCustomFilterLength = 40

uint smjg.libs.sdwf.commondialog.FileDialog.filterIndex = 1

One-based index of selected filter, or zero if a custom filter has been specified.

LPTSTR smjg.libs.sdwf.commondialog.FileDialog._filePath = null

uint smjg.libs.sdwf.commondialog.FileDialog._maxFilePathLength = 260

LPTSTR smjg.libs.sdwf.commondialog.FileDialog._fileName = null

uint smjg.libs.sdwf.commondialog.FileDialog._maxFileNameLength = 260

LPCTSTR smjg.libs.sdwf.commondialog.FileDialog._initialDir = null

LPCTSTR smjg.libs.sdwf.commondialog.FileDialog._dialogTitle = null

OFN smjg.libs.sdwf.commondialog.FileDialog.flags = cast(OFN) 0

A bitwise combination of flags to customise the file dialog.

ushort smjg.libs.sdwf.commondialog.FileDialog._fileNameOffset = 0

ushort smjg.libs.sdwf.commondialog.FileDialog._fileExtensionOffset = 0

LPCTSTR smjg.libs.sdwf.commondialog.FileDialog._defaultExtension = null

uint smjg.libs.sdwf.commondialog.FileDialog._customHookData = 0

LPOFNHOOKPROC smjg.libs.sdwf.commondialog.FileDialog._hookFunction = null

LPCTSTR smjg.libs.sdwf.commondialog.FileDialog._templateName = null

OPENFILENAMEA smjg.libs.sdwf.commondialog.FileDialog.spec

This dialog specification as a Windows OPENFILENAMEA structure.

OFN smjg.libs.sdwf.commondialog.FileDialog.openFlags

Flags to use when opening a file. Default is OFN.TYPICAL_OPEN.

OFN smjg.libs.sdwf.commondialog.FileDialog.saveFlags

Flags to use when saving a file. Default is OFN.TYPICAL_SAVE.

char [] smjg.libs.sdwf.commondialog.FileDialog.openFilterString

Internal representation of the filter list to use when opening a file.

char [] smjg.libs.sdwf.commondialog.FileDialog.saveFilterString

Internal representation of the filter list to use when saving a file.

The documentation for this class was generated from the following file:

- commondialog.d