Communicate between html extension and c++ plugin
Hi All,
I am developing a html extension for InDesign CC2014. There is a scenario where I need to communicate between the extension and C++ InDesign plugin.
I followed the instructions at http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/cs-extension-builder/pdfs/CC_Extension_SDK.pdf and wrote the extension part of the code. The c++ part of the code hasn't changed from the Flex versions so had no problem there.
I tried to invoke the extension from the plugin and it worked. I registered an event in the plugin to listen for and dispatched another event from the plugin. But the panel doesn't seem to listen or dispatch any event. On the c++ plugin part, the registration and dispatch error codes returned were success codes so the problem is not with the plugin.
Here is the code for the html panel,
I register the event to listen for at the time of page load.
function onLoaded() {
var csInterface = new CSInterface();
// Register the named event handler
csInterface.addEventListener("com.mypluginevent.test", myEventHandler);
}
//Create a named event handler callback function
function myEventHandler(event)
{
alert("Event captured!");
}
// This function is called on a button click
function onClick()
{
// Create your local CSInterface instance
var csInterface = new CSInterface();
var event = new CSEvent("com.myhtmlevent.test", "APPLICATION");
event.data = "This is a test!";
csInterface.dispatchEvent(event);
}
Here is the C++ part of the code where I dispatch the "com.mypluginevent.test" event.
csxs::event::Event event = {"com.mypluginevent.test",
csxs::event::kEventScopeApplication,
"myEventHandler",
NULL,
NULL};
csxs::event::EventErrorCode err = sdkPlugPlugInstance.DispatchEvent(&event);
I always get success on dispatching the event, yet the extension does not catch it.
Can anyone tell what I am doing wrong?
