Example: Monitoring the Number of Objects in a Manager

The following code is a subclass of IlvManagerViewHook that displays in an IlvTextField the number of objects contained in the manager:

class DisplayObjectsHook

: public IlvManagerViewHook

{

public:

DisplayObjectsHook(IlvManager* manager,

IlvView* view,

IlvTextField* textfield)

: IlvManagerViewHook(manager, view),

_textfield(textfield)

{}

virtual void contentsChanged();

protected:

IlvTextField* _textfield;

};

 

 

void DisplayObjectsHook::contentsChanged()

{

IlvUInt count = getManager()->getCardinal();

_textfield->setValue((IlvInt)count, IlTrue);

}