3 Replies Latest reply on Jun 4, 2015 3:12 PM by Francis Harvey

    Context sensitive menu command.

    Alex Steinberg

      Hi,

       

      I've got an add in for EPDM that works but now I want it to only be available to run if the document is in a certain state. ie I would like the menu command to only be visible if the selected file is in our "Controlled" state. Is there any way to do this? I've come across the EDMMenuFlags enumeration but it is too limited in scope.

        • Re: Context sensitive menu command.
          Francis Harvey

          Hi Alex,

           

          This is exacly what i'm looking for since a while,

          I did not find anything about it yet, just looking again this year...

           

          So for those who did not understand the issue,

          We need to enable/disable command menu item based on our custom logic.

          The predefined flags like EdmMenu_OnlyFiles, EdmMenu_OnlySingleSelection, EdmMenu_MustHaveSelection are just not enough...

           

          In Solidworks App, there is an update event callback for every command item,

          Is something similar exists in EPDM?

          • Re: Context sensitive menu command.
            Klaudiusz Skiba

            Dismiss my previous comment.

             

            ok you can disable/enable command tab in menu.

            I'm guessing you are adding command item this way:

            'value = instance.AddCommandItem2(Name, Position, HintString, ToolTip, ImageListIndex, CallbackFunction, EnableMethod, UserID, MenuTBOption)

            Instead of enablemethod put "EnableEPDM"

            Then in UI callbacks  add

            Function EnableEPDM

            if (your logic here) = true then

            return 1

            else

            return 0

            end function

             

            you can post your logic here and i'll put it together

              • Re: Context sensitive menu command.
                Francis Harvey

                Hi Klaudiusz,

                 

                This method apply to Solidworks CAD, not PDM...

                 

                Here's the EPDM method to use:

                poCmdMgr.AddCmd(1000, My.Resources.Activate, EdmMenuFlags.EdmMenu_HasToolbarButton, My.Resources.ActivateTooltip, My.Resources.ActivateTooltip, 0, 99)

                 

                And the Solidworks CAD one you talk about:

                cmdGroup.AddCommandItem(My.Resources.MsgTlbSWActivate, -1, My.Resources.MsgTlbSWActivateToolTip, _

                My.Resources.MsgTlbSWActivate, 0, "ActivateMenu", "ActivateMenuUpdate", 0)

                 

                Regards,

                Francis Harvey