Editing Container Objects

The L_ContainerEditObject function displays an object and lets the user edit the dimensions of that object. This function displays the object based on its initial properties which are set in a CONTAINEROBJECTDATA structure. As the user edits this object, all changes (state and object properties) are sent to the CONTAINERCALLBACK function for processing.

The following example shows how to display and edit an object in a container. In this example the container is using two container-specific data structures, as follows:

CONTAINEROBJECTDATA

CONTAINERPOLYLINEDATA

The CONTAINEROBJECTDATA data structure contains the object data for the container.

The CONTAINERPOLYLINEDATA structure is used to describe the polyline object to be edited.

/* This example shows how to edit a container object. It assumes  
that the container limits are at least { 10, 10, 300, 200 } */ 
L_INT EditObjectTest(pCONTAINERHANDLE pContainer) 
{ 
   if (SUCCESS == L_ContainerIsValid(pContainer)) /* check the validity of container handle */ 
   { 
      CONTAINEROBJECTDATA Data; 
      CONTAINERPOLYLINEDATA   PolyData; 
      VECTORPOINT pt[7]; 
      /* Set the Polyline points to some random numbers */ 
      pt[0].x = 10;   pt[0].y = 10; 
      pt[1].x = 80;   pt[1].y = 20; 
      pt[2].x = 100; pt[2].y = 60; 
      pt[3].x = 10;   pt[3].y = 40; 
      pt[4].x = 100; pt[4].y = 200; 
      pt[5].x = 200; pt[5].y = 100; 
      pt[6].x = 300; pt[6].y = 200; 
      /*Fill the object data with valid values */ 
      PolyData.pvptPoints = pt; 
      PolyData.nPointCount = 7; 
      /* Set the container's object data */ 
      Data.nSize = sizeof(CONTAINEROBJECTDATA); 
      Data.nObjectType = CONTAINER_OBJECT_TYPE_POLYLINE; 
      Data.pObjectData = &PolyData; 
      /* Start editing an object */ 
      /* Double-click the left-mouse button to end editing */ 
      /* Click the right-mouse button to abort editing */ 
      if (SUCCESS != L_ContainerEditObject(pContainer, &Data)) 
      { 
         return FAILURE; 
      } 
      return SUCCESS; 
   } 
   else 
   { 
      return FAILURE; 
   } 
} 

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

LEADTOOLS Container and Automation C API Help