1 Reply Latest reply: May 22, 2012 3:05 PM by Dirk Becker RSS

    How SetGeometricBounds of a Rectangle

    Bill joy Community Member

      I am creating a rectangle using vc++.

      There is a problem to use the SetGeometricBounds() function in vc++. It take one argument but there is requirement of four argument. But this function work welll in C#

      InDesign.Rectangle rectangle = page.Rectangles.Add(document.Layers.FirstItem(), idLocationOptions.idUnknown, page);

      rectangle.GeometricBounds = new[] { 20, 30, 120, 130 };

      My Steps are

      INDESIGN::Rectangle rectangle = rectangles.Add(covOptional,(long)1433299822,covOptional);

      rectangle.SetGeometricBounds(const VARIANT &newValue);

      SetGeometricBounds() function take one argument const VARIANT &newValue but parameter should be Array of Measurement Unit (Number or String). When i pass an array of these measurement unit then it also give error.



        • 1. Re: How SetGeometricBounds of a Rectangle
          Dirk Becker Community Member

          You apparently use C++ with the "high level" scripting API, while this forum is traditionally the place for "low level" plugins. For scripting API questions probably your issues are better answered in the scripting forum even though I think you'll earn some stares when you mention your choice of C++. Why would you jump thru hoops of that more demanding language just to end up at the same thing that you'd get with a better supported scripting language?


          Anyway, if you're in doubt what to feed into a setter method, just use the matching getter and inspect the result. It is again beyond me though how to use reflection of managed code in C++. I'd try just the equivalent to an array of 4 doubles if that differs from your quoted code "new [] {...}" above, but again I don't know how to produce that. Maybe add a "double" keyword at the appropriate place?


          I think there are also some tools to disassemble your working C# code so you'd learn what magic conversions are used under the hood there.