DropMany

D

dani

Hi,

has anyone here used the DropMany method in Delphi before? I can try
whatever I want, the method does not fill my array of shape IDs...

I can successfully give the masters and the positions of the masters to
drop to Visio, and it is also drawing these shapes, and the return value
of DropMany is also correct.

But the third SafeArray (aShapeIDs) somehow stays untouched (in this
case, all 0's).

Does anyone have an idea what might be wrong here?

thanks for help

Daniel


here's my code:

var
aMasters, aPositions, aShapeIDs: PSafeArray;
ArrayBounds: TSafeArrayBound;
data: Pointer;
tmpArray: IntegerArray;
i: Integer;
...
begin
...
ArrayBounds.lLbound := 0;
ArrayBounds.cElements := <some integer>;
...
aShapeIDs := SafeArrayCreate( varInteger, 1, ArrayBounds );
...
SafeArrayAccessData(aShapeIDs,data);

i := activePage.DropMany(aMasters,aPositions,aShapeIDs);

tmpArray := IntegerArray(data);

for i := 0 to <some integer> do begin
objID := tmpArray;
...
end; //for i

SafeArrayUnAccessData(aShapeIDs);
 
M

Markus Breugst

Hi Daniel,

I don't know anything about Delphi, but we use DropMany in C#, and the
ShapeID list is correctly filled with the IDs of the dropped shapes. In C#,
we have to specify this list as out parameter. Here is the line:

page.DropMany( ref _masterShapes, ref _xyPositions, out _idArray );

Perhaps this is similar in Delphi?

Best regards,
Markus
 
D

dani

Hi Markus

I still didn't get it work, but I found a workaround... I listen to the
ShapeAdded event, so I get the added shape(s). This is even better than
getting the IDs and then searching for the shape.

still, thanks for your help

Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top