3 Replies Latest reply on Jan 1, 2014 12:39 AM by Michael Dekoning

    How to get the value of a control on a template card - API

    Brian Dalton

      I would like to add a button to a template card so that the person who is using the template can select a file via a dialog box.  I would then populate other fields on the template card using data from the selected file.


      I can hook the button, get the interface to the control (IEdmCardControl5), but I can't see how to get the value of the control, which is an editbox.


      Now that I think about it, I need to be able to set the values of editboxes as well, and I can't see how to do that either.


      Any suggestions?

        • Re: How to get the value of a control on a template card - API
          Lee CS Young

          I'm curious, why are you going about it this way?


          If you're loading a file you would read the values from the file, not the corresponding card.


          What are you trying to achieve? It sounds like you may not need a template at all.

            • Re: How to get the value of a control on a template card - API
              Brian Dalton

              You're correct, Lee.  I don't need to read the values from the card, but I do need to write values to it once I've read the corresponding file, so I will need to access the value of an editbox for the purpose of setting it.


              My best guess at accessing the values (reading or writing) on a template card is to use poCmd.mpoExtra to get a reference to the EnumeratorVariable object.  This seems obsure, because variables are typically read from a file, and in the case of a template the file doesn't exist yet.  It's the only possible solution I can see, though.


              Sadly, I can't test my theory because (again) EPDM patently refuses to allow me to debug my code.  I can't even install the addin in debug mode.


              There are many posts from others on this forum about the stupid problems that occur when trying to do this and the insane workarounds that people are having to use.  None of them are working for me, so I'm forced to abandon this project entirely.


              It is nothing short of shameful for SolidWorks to charge thousands of dollars for a product then leave these sort of egregious bugs unaddressed for years.