LAutomation::SetCurrentTool

Summary

Manually sets the current tool in an automation handle without using the toolbar.

Syntax

#include "ltwrappr.h"

L_INT LAutomation::SetCurrentTool(nTool)

Parameters

L_INT nTool

An integer value that represents the tool to set. For more information about tools, tool identifiers and toolbar buttons, refer to the LEADTOOLS Toolbar C++ Class Library help.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function lets you simulate a toolbar, instead of using one provided by LEAD Automation.

Required DLLs and Libraries

See Also

Functions

Topics

Example

This example displays the current tool in the automation, and then changes it to nNewTool.

L_VOID GetToolName(L_INT nTool, L_TCHAR *pszTool) 
 
{ 
 
   lstrcpy(pszTool, TEXT("Unknown")); 
 
   switch (nTool) 
 
   { 
 
   case ID_TOOL_VECTOR_NONE      : 
 
      lstrcpy(pszTool, TEXT("No Tool")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_SELECT    :  
 
      lstrcpy(pszTool, TEXT("Vector Select")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_VERTEX    :  
 
      lstrcpy(pszTool, TEXT("Vector Vertex")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_LINE      :  
 
      lstrcpy(pszTool, TEXT("Vector Line")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_RECTANGLE :  
 
      lstrcpy(pszTool, TEXT("Vector Rectangle")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_POLYLINE  :  
 
      lstrcpy(pszTool, TEXT("Vector Polyline")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_POLYBEZIER:  
 
      lstrcpy(pszTool, TEXT("Vector PolyBezier")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_POLYGON   :  
 
      lstrcpy(pszTool, TEXT("Vector Polygon")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_ELLIPSE   :  
 
      lstrcpy(pszTool, TEXT("Vector Ellipse")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_CIRCLE    :  
 
      lstrcpy(pszTool, TEXT("Vector Circle")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_ARC       :  
 
      lstrcpy(pszTool, TEXT("Vector Arc")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_TEXT      :  
 
      lstrcpy(pszTool, TEXT("Vector Text")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_PIE       :  
 
      lstrcpy(pszTool, TEXT("Vector Pie")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_CHORD     :  
 
      lstrcpy(pszTool, TEXT("Vector Chord")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_RASTER    :  
 
      lstrcpy(pszTool, TEXT("Vector Raster")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_ROTATE    :  
 
      lstrcpy(pszTool, TEXT("Vector Rotate")); 
 
      break; 
 
       
 
   case ID_TOOL_VECTOR_PAN       :  
 
      lstrcpy(pszTool, TEXT("Vector Pan")); 
 
      break; 
 
   } 
 
} 
 
L_INT LAutomation_SetCurrentToolExample(LAutomation &Automation, L_INT nNewTool)  
 
{ 
   L_INT nOldTool; 
 
   L_INT nRet; 
 
   L_TCHAR szTool[100]; 
 
   nRet = Automation.GetCurrentTool(&nOldTool); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   GetToolName(nOldTool, szTool); 
 
   MessageBox(NULL, szTool, TEXT("Old Tool"), MB_OK); 
 
   nRet = Automation.SetCurrentTool(nNewTool); 
 
   if (nRet == SUCCESS) 
 
   { 
 
      GetToolName(nNewTool, szTool); 
 
      MessageBox(NULL, szTool, TEXT("New Tool"), MB_OK); 
 
   } 
   else 
 
   { 
 
      return nRet; 
 
   } 
 
   return SUCCESS; 
} 

Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Container and Automation C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.