Gantt > Using the Gantt Chart Through Examples > Registering Gantt Data Change Hooks > Name Property Change Hook
 
Name Property Change Hook
This hook, which is also useful when graphic models are defined for customization, must have the following signature:
typedef void (* IlvGanttSetGraphicName)(IlvGanttAbstractObject* object,
IlvGraphic* model,
IlvGanttObjectType type,
IlvAny arg);
The object parameter is an instance of the IlvGanttLine, IlvGanttNode, or IlvGanttLink classes. The model parameter is the graphic object used as a model to create the IlvGanttAbstractObject object. The type parameter is one of the values defined by the IlvGanttObjectType enum, and arg is additional information (which can be useful, for example, when the IlvGanttAbstractObject object is an IlvGanttSubNode object).
typedef enum IlvGanttObjectType {IlvGanttIsLine,
IlvGanttIsNode,
IlvGanttIsLink};
There is a user-defined example in <ILVHOME>/samples/gantt/common/src/utils.cpp:
// --------------------------------------------------------------------------
void
OnGanttObjectNameChanged(IlvGanttAbstractObject* object,
IlvGraphic* graphic,
IlvGanttObjectType type,
IlvAny index)
{
if (graphic->getClassInfo()->isSubtypeOf(IlvMatrix::ClassInfo())) {
if (type == IlvGanttIsLine ) {
IlvMatrix* matrix = (IlvMatrix*)graphic;
IlvAbstractMatrixItem* item;
item = matrix->getItem(0,0);
item->setLabel(object->getName());
item = matrix->getItem(1,0);
char buffer[16];
sprintf(buffer, "%d", ((IlvGanttLine*)object)->getCapacity());
item->setLabel(buffer);
}
} else if(graphic->getClassInfo()->isSubtypeOf
(IlvMessageLabel::ClassInfo())) {
IlvMessageLabel* label = (IlvMessageLabel*)graphic;
label->setLabel(object->getName());
} else if(graphic->getClassInfo()->isSubtypeOf
(IlvShadowLabel::ClassInfo())) {
IlvShadowLabel* label = (IlvShadowLabel*)graphic;
label->setLabel(object->getName());
}
 
if (type == IlvGanttIsNode ) {
IlvGanttNode* node = (IlvGanttNode*)object;
IlvGanttSubNode* subnode = node->getSubNode(*((IlUShort*)index));
graphic->setNamedProperty(new IlvGanttSubNodeToolTip(subnode));
}
}
This user-defined function of type IlvGanttSetGraphicName will automatically be called in the cases previously mentioned.

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.