2 Replies Last post: Aug 26, 2008 10:37 AM by Manuel Crespo  
Manuel Crespo   12 posts since
Apr 24, 2006
Currently Being Moderated

Aug 20, 2008 7:14 PM

Access the instance of the event class

 

Hello,

 

 

I think this is an easy question. When I create the objects, the event handler (ViewerEventImplementation in the example) is created by the factory by server.createInstance. I need to acces to the instance of ViewerEventImplementation  that has been created in order to call some methods, stablish some properties, but I don't know how?. This ViewerEventImplementation is an extension of the EventsServer created automatically with the generation tool.

 

 

Manu thanks for all,

Manuel Crespo

 

 

 

 

Example:

 

 

        container.createObject(Ax3dObj.CLASSID);

        ax3dObjImpl = new IAx3dObjImpl(_container.getOleObject());

 

 

        IClassFactoryServer server = new IClassFactoryServer(ViewerEventImplementation.class);

        server.registerInterface(_IAx3dObjEventsImpl.class, new IDispatchVTBL(server));

        server.setDefaultInterface(IDispatch.class);

 

 

        IDispatchImpl handler = new IDispatchImpl();

        server.createInstance(null, handler.getIID(), handler);

 

 

        IConnectionPointContainer connectionPointContainer = new IConnectionPointContainerImpl(ax3dObjImpl);

        IConnectionPoint connectionPoint = connectionPointContainer.findConnectionPoint(new IID(_IAx3dObjEventsImpl.INTERFACE_IDENTIFIER));

        connectionPoint.advise(handler);

 

 

Serge Piletsky TeamDev Ltd. 670 posts since
Apr 24, 2006
Currently Being Moderated
1. Aug 21, 2008 3:41 PM in response to: Manuel Crespo
Re: Access the instance of the event class

Hi Manuel,

 

There is the answer to this question in the ComfyJ Programmer's Guide: http://www.teamdev.com/downloads/comfyj/docs/ComfyJ-PGuide.html#Registering_Callbacks, though it may be not quite obvious; here is the example:

ViewerEventImplementation impl = (ViewerEventImplementation)server.getInstances().pop();

 

Please let me know if you have another question.

 

-Serge

More Like This

  • Retrieving data ...