Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
700
Adding derived tools
posted

Hello,

I created a class derived from ButtonTool so that I could add some properties.  There is a hitch however.

When adding to the toolbarmanager and ribbon, no problem.  Shows up fine.  The problem comes when consuming the ToolClick event.  I was hoping to be able to do something like if (e.Tool is MyCustomToolClass) {} and not have to rely on tags or some such error prone method.

However, when the tool gets there it is just a base tool class and cannot even be explicitly cast to be my custom tool class.  This seemed odd.  So I added a form level MyCustomToolClass variable and set it equal to the new instance of it and added it to the toolbar and ribbon as normal.  When we got to the toolclick event though (e.Tool == FormLevelToolVariable) returned false.  So it looks like either when adding the tool to the toolbar or when it is passed through to the event it isn't actually my instance that is available but a newly created tool base object.

 Any thoughts?