The ND documentation says that, you can map the events associated with
visual objects to user defined methods in onAfterInitEvent(). This will be
helpful when the same code is used by many visual objects for
initialization. Instead of calling the user defined function in
visulaObject_onBeforeDisplayEvent(), we can map this method to event's
onBefore...Event() using CSpVisual.mapEvent() method

Even though usage looks perfect for me, am getting the following error (ND
4.1):
spider.event.adapters.CSpPageEventAdapter.addEventMapping: Can't find the
method 'myMappingFunction' in target Object
of type 'myProject.myPage'

The code used is like this:

public int this_onAfterInitEvent(CSpInitEvent event)
{
        int numOfChildren = _children.size ();  //list of visuals
        for (int i = 0; i < numOfChildren; i++)


                CSpVisual v = (CSpVisual)_children.elementAt (i);
                v.mapEvent ("onBeforeDisplayEvent", this, "myMappingFunction",
getEventAdapter (), false);
        }
        return (PROCEED);
}


private int myMappingFunction(CSpDisplayEvent event)
{
        populatePlease((CSpVisual) event.getSource());  //Call generic routine now
}

(ND Documention Series reference: "Changes You Have to Make to Your Code"
under "Migrating NetDynamics Projects to 4.x." of "Technical Briefs".
.../NetDynamics/NetDynamics40/Docs/res/techbriefs/migrate.html#@Changes)


Thanks for your time,
Krupesha


winmail.dat

Reply via email to