1 Reply Latest reply on Jun 5, 2015 8:11 AM by Jim Sculley

    Get a button by code

    Jason King

      Hello,all.

      I create a new SwAddin project in my visual studio,and I debug it.Then the solidworks application looks like this:

      old.png

      Now,I'd like to get these button by code to make them enable=false.How can I do that,anyone knows?Thank you.

        • Re: Get a button by code
          Jim Sculley

          The AddCommandItem method includes an argument that is a callback method for enabling/disabling the item.  You can pass the name of a method as the parameter and the method will be called every time something happens that might cause the enable status to change.  Based on conditions, you can decide whether or not the item should be enabled and return the appropriate value (0,1,2,3).

           

          Jim S.