APIEnv_​GetToolBoxModeID

Returns the actual toolbox mode.

    GSErrCode ACAPI_Environment (
        APIEnv_GetToolBoxModeID,
        API_ToolBoxItem*     toolBoxItem
    );

 

Parameters

toolBoxItem
[out] Current toolbox mode data.

 

Return Values

NoError
The function completed with success.
APIERR_BADPARS
toolBoxItem is nullptr

For other common API errors see the API Errors document.

 

Remarks

This function is used to get the current toolbox mode. The mode is returned in the type field. For those types which can have more toolbox modes (ID_Wind, ID_Door, ID_Symb, ID_Light), the owner ID of the tool is returned, too. If the current toolbox mode has no element type associated with (e.g. arrow mode and marquee mode), the typeID will be API_ZombieElemID.

To change the active toolbox item use the APIEnv_SetToolBoxModeID function.

 

Example


API_ToolBoxItem tboxInfo;
BNZeroMemory (&tboxInfo, sizeof (API_ToolBoxItem));

GSErrCode err = ACAPI_Environment (APIEnv_GetToolBoxModeID, &tboxInfo, nullptr);
if (err == NoError) {
    GS::UniString elemName = "unknown";
    ACAPI_Goodies_GetElemTypeName (tboxInfo.type, amp;elemName);

    char buffer[256];
    if (tboxInfo.type == API_ZombieElemID) {
        sprintf (buffer, "Previous toolbox mode: Arrow or Marquee");
    } else if (tboxInfo.type.variationID == APIVarId_Generic) {
        sprintf (buffer, "Previous toolbox mode: %s", (const char*) elemName.ToCStr ());
    } else {
        char *p = (char *) &tboxInfo.type.variationID;
        sprintf (buffer, "Previous toolbox mode: %s  variation \"%c%c%c%c\"",
                    (const char*) elemName.ToCStr (), p[0], p[1], p[2], p[3]);
    }

    ACAPI_WriteReport (buffer, false);
}

 

Requirements

Version: API 2.1 or later
Header: APIdefs_Environment.h

 

See Also

API_ToolBoxItem,
APIEnv_SetToolBoxModeID,
ACAPI_Environment, API Functions