IAdeUICallbacks::GetFilename

Revision as of 18:26, 29 August 2016 by Lchrisman (Talk | contribs) (15727)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

ADE User Guide > ADE Server Class Reference > IAdeUICallbacks

Other languages:
English • ‎中文

string GetFilename([in] string function, [in] string defaultName, [in] string directory, [in] string extensions, [in] string caption, [in] CAObject* callingIdent, [in] int flags)

Called when any of several functions are evaluated, when the user needs to be asked to select a filename. These include SpreadsheetOpen(), ReadTextFile(), ReadImageFile(), and ReadExportFile.

Your implementation should allow the user to select a file, or if your are implementing a web-based application, you may allow him to upload a file.

After the file is read, the IAdeUICallbacks::FileOpenCompleted() is called. If your application has uploaded a file to a temporary location, you can safely delete the temporary file here.

The method is not called if the dialog is unnecessary.

The callback is displayed only when it is necessary to get filename info from the user. In general, if the filename provided to the function exists, and «ForceDialog» is not explicitly true, then ADE will read the file without prompting the user, and hence, the callback is never called. An exception, however, is for SpreadsheetSave, in which the callback is always called. Your implementation can view the «flags» to see whether the dialog was forced or not, and you can view the «defaultName» to see whether the filename was specified. You should never show a dialog when the 2 bit of «flags» is set.

Parameters

  • «function»: the identifier of the built-in function that is requesting the filename. E.g., "SpreadsheetOpen", "ReadTextFile", "ReadImageFile", or "ReadExportFile".
  • «directory»: The current directory.
  • «extensions»: A list of file extensions to filter for. When there is more that one possible extension, they are separated by a double bar, "||". Each extension has two parts, separated by a single bar, "|". The first part is a list of wild cards such as "*.txt;*.dat", each wildcard separated by semi-colons. The second part is a user-friendly description of the extension. For example, SpreadsheetOpen may provide the following filter: "*.xl*;*.csv|Excel Files (*.xl*;*.csv)||*.*|All Files (*.*)"
  • «caption»: The recommended title or caption text for a file open dialog.
  • «callingIdent»: A CAObject pointer to the user-object in the model that is calling the build-in function.
  • «flags»: A bit field, with these bits:
    • 1 = Force Dialog was explicitly set to True
    • 2 = Force Dialog was explicitly set to False (suppress dialog)
    • 4 = This is a Write operation (such as SpreadsheetSave or WriteTextFile).

Return value

The full file path to the file selected or uploaded.

See Also

Comments


You are not allowed to post comments.