Skip to Content
Oct 07, 2005 at 01:54 PM

Subscribe to events on runtime



I need some help on dynamic creation of embedded components.

I'm trying to create any number of embedded components (inner components) -each time the user clicks a button- and inserting them in a tabstrip into de embedder component (outer component). Morover, each inner component could fire a server-side event that the outer component must catch and take an accion.

Up to now, I solved the issue of creating the inner components and adding them to the tabstrip. But I don't know how to subscribe an event handler (declared in the outer component at disign time) to the events of the inner components (this must be done at runtime).

I've tryed something like this:

IWDCustomEventInfo   eInfo = wdThis.wdGet<inner_component>Interface().getEventInfo();
IWDEventHandlerInfo ehInfo = wdControllerAPI.getControllerInfo().findInEventHandlers("<my_event_handler>");
IWDController	controller = wdThis.wdGet<inner_component>Interface().wdGetAPI();

wdComponentAPI.addEventHandler(eInfo, ehInfo, controller);

But it didn't work. I got the error:


I would appreciate any help.

Best regards,

Juan José García Samartino.