How to Handle Button Click in C++ COM Add-In?

Add-in Express™ Support Service
That's what is more important than anything else

How to Handle Button Click in C++ COM Add-In?
 
Jason Crabtree




Posts: 19
Joined: 2007-01-23
Hello,

I noticed in an Excel C# example, there is a line of code that sets up the button click event in the InitializeComponent section. That section also says not to modify the code. When I create a C++ add-in project though, there is no code generated for the click event. How do I set up that event, so that I can handle the click of the button in a C++ COM add-in? Example code would be great, as I'm still getting the hang of this :D .

Also, I'm stuck with the C++ add-in for now, otherwise I'd switch over.

Thanks!
Posted 23 Jan, 2007 17:06:43 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Jason.

You can add events at the design time.
1. Open the addinmodule designer.
2. Add the ADXExcelAppEvents component via the 'Add events' option of the addimmodule context menu.
3. Right click on the component and open the Properties window.
4. Choose the Events tab.

Now you can add events that you need.

P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.

Posted 24 Jan, 2007 08:10:05 Top
Jason Crabtree




Posts: 19
Joined: 2007-01-23
Thanks, that was really quick! I didn't notice that little events tab when I selected my button from the properties window. I double-clicked the field next to the click property, and voila, I had my click handler.

In case anyone else is looking at this post for help... I don't think I needed to add the ADXExcelAppEvents component afterall, since the button was part of my adxCommandBar. I probably didn't phrase my question clearly, but it looks like I don't need the ADXExcelAppEvents, unless I want to handle Excel-based events in particular. I was just trying to handle my commandbar button click. Correct me if I'm wrong about that though.

Thanks again!
Posted 24 Jan, 2007 15:22:01 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Jason, you are right.
Posted 25 Jan, 2007 06:49:42 Top