Control the toolbar button (Enable or Disable)

Oct 18, 2006 2 Replies

Hi all!!!



Someone can help me with toolbar? My problem is when i want to enable or disable my button in my own toolbar, because i have created my own add-in. And for example i want to disable a button when i open a part or drawing. Someone know how i can do this?



P.S.: I already look at the example on solidworks web site.



Thanks for your help!



I have an addin construction example at ("Create SolidWorks addin from macro in VB6 "). The comments in the addin module include explanations of toolbar functionality.

You can grey-out a toolbar using the "ButtonEnableMethod" parameter of "AddToolbarCommand". Write a function that returns 0 if part or drawing and 1 for assembly, and call that function for the enable parameter..

You can also limit a toolbar's availability to certain document types using the "DocumentType" parameter of "AddToolbar4".

Thank you for your answer but the function enabledifpart don't work in my DLL and i can't debbug it in VB or i don't know how. How can i see if the document in solidworks is part or any other document? With my menu all works very well, but my toolbar is more difficult. I see my toolbar but it's stay always active.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required