APIIo_​SaveLibPartFileDialogID

Opens the Save Library Part dialog and returns the selected location.

    GSErrCode ACAPI_Interface (
        APIIo_SaveLibPartFileDialogID,
        bool*              retCode,
        IO::Location*      location,
        bool*              browseForFolder,
        GS::UniString*     dialogTitle,
        GS::UniString*     dialogTypeStr
    );

 

Parameters

retCode
[out] returns whether the dialog was closed with confirmation (OK, Save, etc.)
location
[in/out] sets the default library and filename to open the dialog with, and returns the location of the chosen file
browseForFolder API 16 feature
[in] enables the dialog to save Library Parts outside the Embedded Library (optional; the default value is false)
dialogTitle API 16 feature
[in] defines the title of the dialog (optional)
dialogTypeStr API 20 feature
[in] defines the library part type of the dialog (optional); applicable identifiers are: "ExportObjectDialog" (default), "ExportDoorDialog", "ExportWindowDialog"

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
retCode or location is nullptr.

For other common API errors see the API Errors document.

 

Remarks

Use this function to let the user choose a file location for saving a library part in the loaded libraries.

The function needs a valid location to open the dialog from.

The location is set only if the dialog was closed with confirmation button (OK, Save, etc.).

 

Example


bool         done = false;
bool         retIsOk = false;
IO::Location location ("Untitled");
do {
    GSErrCode err = ACAPI_Interface (APIIo_SaveLibPartFileDialogID, &retIsOk, &location);
    if (err == NoError && retIsOk) {
        API_LibPart libPart;
        BNZeroMemory (&libPart, sizeof (API_LibPart));

        IO::Name name;
        location.GetLastLocalName (&name);

        CHTruncate (name.ToString ().ToCStr (), libPart.file_Name, sizeof (libPart.file_Name));
        if (ACAPI_LibPart_Search (&libPart, false) == NoError) {
            ACAPI_WriteReport ("Library part with this name already exists, please choose different name.", true);
            done = false;
        } else {
            done = true;
        }
        if (libPart.location != nullptr)
            delete libPart.location;
    } else {
        done = true;
    }
} while (!done);

 

Requirements

Version: API 10 or later
Header: APIdefs_Interface.h

 

See Also

ACAPI_Interface, API Functions