To rotate objects you must first make sure you obtain the ihObj by setting it to the selected objects. If ihObj is -1 then the object is unknown, so your code will not function. The invalid object index exception occurs because ihObj is -1. This will rotate all selected objects (grips are visible on the object):
procedure TForm1.Rotate1Click(Sender: TObject);
{ Rotate selected objects. }
var
i: Integer;
ihObj: Integer;
iRotateAngle: Integer;
begin
with ImageEnVect1 do
begin
for i := 0 to SelObjectsCount - 1 do
begin
if i >= 0 then
begin
ObjSaveUndo;
ihObj := SelObjects[i];
if ihObj <> -1 then
begin
iRotateAngle := 90;
RotateObject(ihObj, iRotateAngle, ierObject);
end;
end;
end;
Update;
end;
end;
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development