Using the Container Callback

When an object is drawn in a container a series of states occur during the process of drawing that object. The state can be the beginning of the drawing process, a continuation of the drawing process, the ending of the drawing process, or the aborting of the drawing process. The following states are currently supported for processing:

These states are sent to a user-defined callback function for further user-defined processing. When the callback function is notified of the state of an object, information concerning the object being processed is also sent to the callback function. The callback function must adhere to the function prototype described in CONTAINERCALLBACK. The form of this callback function can also be seen below:

L_INT EXT_CALLBACK YourFunction( 
   pCONTAINERHANDLE pContainer, 
   CONTAINEREVENTTYPE nEventType, 
   L_VOID *pEventData, 
   L_VOID *pUserData); 

The callback function receives the following information:

Before a callback function can be used, it must be set for the container using the L_ContainerSetCallback function. To determine the callback function that is currently set for a container, call L_ContainerGetCallback.

The following example shows how to process the states of a line object:

L_INT EXT_CALLBACK LeadContainerProc( 
pCONTAINERHANDLE pContainer, 
CONTAINEREVENTTYPE nEventType, 
L_VOID *pEventData, 
L_VOID *pUserData) 
{ 
   pCONTAINEROBJECTDATA pObjectData = (pCONTAINEROBJECTDATA)pEventData; 
   switch (nEventType) 
   { 
      case CONTAINER_EVENT_TYPE_DRAW: 
      { 
         switch (pObjectData->nObjectType) 
         { 
            /* Process the line object events */ 
            case CONTAINER_OBJECT_TYPE_LINE: 
            { 
               switch (pObjectData->fState) 
               { 
                  case CONTAINER_STATE_BEGIN: 
                  /* do something */ 
                  break; 
                  case CONTAINER_STATE_PROCESS: 
                  /* do something */ 
                  break; 
                  case CONTAINER_STATE_END: 
                  /* do something */ 
                  break; 
                  case CONTAINER_STATE_ABORT: 
                  /* do something */ 
                  break; 
               } 
            } 
            break; 
         } 
      } 
      break; 
   } 
   return SUCCESS; 
} 

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

LEADTOOLS Container and Automation C API Help