[V8i C#] PartialDelete bug

It seems like Element.PartialDelete (Partial1, Partial2, Point1, Point2, Selector, ViewSpecifier) is using viewIndex + 1 instead of the passed in viewIndex. Probably a mixup between 1 based and 0 based indexing when calling the underlining mdl code.

If I pass in the view object directly, it seems to be reading that views index and confusing that as well.   I cannot pass viewIndex - 1 as that will cause a COM error on view 1.



  • Unknown said:
    Element.PartialDelete (Partial1, Partial2, Point1, Point2, Selector, ViewSpecifier)

    The documentation for that VBA method tells us: ViewSpecifier A VARIANT expression. A View object, or an index in the range 1 through 8.  VBA usually takes the user side of the argument about arrays starting at zero or one.

    How have you declared that function for C# to be able to use it?  The problem may arise because of the way VBA handles Optional arguments, which is a different mechanism to overloaded functions in the C#, C++ style.  For that matter COM doesn't support overloading either.

    The parameter is evidently a VARIANT, which is a Win32 union.  The VARIANT in this case can store a long view index or an IUnknown*, which points to the VBA View object.  So perhaps what you must pass in is a VARIANT initialised with the long view index.  I can't help you with that, so search for ideas on the Internet.

     
    Regards, Jon Summers
    LA Solutions

  • Jon,

    Unknown said:
    How have you declared that function for C# to be able to use it? 

    Not sure what you mean here. I am calling the function directly from the COM API and there should be nothing extra that I need to declare?

    The ViewSpecifier is an object data type and does not require any unique ways of initializing it to an integer\long\View other than just setting it equal to that value.

    I believe the COM API is receiving the view specifier correctly with a 1 based index, however, internally it is calling mdlElmdscr_partialDelete by passing the 1 based index instead of subtracting 1 to get the 0 based index which is required in mdl.

    I have fixed this already on my end by calling mdlElmdscr_partialDelete directly

  • Unknown said:
    I am calling the function directly from the COM API and there should be nothing extra that I need to declare?

    OK

    Unknown said:
    The ViewSpecifier is an object data type and does not require any unique ways of initializing it to an integer\long\View other than just setting it equal to that value.

    As I suggested above, you're really assigning the IUKnown* interface of the VBA COM object to the appropriate field in the VARIANT.  Or, if you use an integer (VBA Long) index, you're assigning an I4 field in the VARIANT union.

    Unknown said:
    I have fixed this already...

    If that's working then don't attempt to resolve the COM stuff.  Just keep it in mind the next time you want to use a VBA call that involves  an optional parameter that wants a VARIANT .

     
    Regards, Jon Summers
    LA Solutions