I can not get it to function well either. I can set the selection, but the coordinates are not correct. I have no idea why. I even tried to convert XY to Bitmap coordinates without success. However, your XY coordinates are incorrect.
MyX := ievMain.ObjLeft[SelectedObjID];
MyY := ievMain.ObjTop[SelectedObjID];
MyW := ievMain.ObjWidth[SelectedObjID];
MyH := ievMain.ObjHeight[SelectedObjID];
ievMain.Select(MyX, MyY, MyX + MyW, MyY + MyH);
I guess I am having a bad day, I should be able to get it to work.
ImageEnVect.LockUpdate and ImageEnVect.UnLockUpdate may be necessary to see the selection. Without that I do not even see a selection.
procedure TForm1.dxBarButton1Click(Sender: TObject);
var
i: Integer;
iLeft: integer;
iTop: integer;
iX: Integer;
iY: Integer;
iX2: Integer;
iY2: Integer;
iWidth: Integer;
iHeight: Integer;
iHObj: Integer;
begin
if Assigned(cxPageControl1.ActivePage) then
begin
ImageEnVect := TImageEnVect(cxPageControl1.ActivePage.Controls[0]);
if Assigned(ImageEnVect) then
begin
ImageEnVect.LockUpdate;
for i := 0 to ImageEnVect.ObjectsCount - 1 do
begin
iHObj := ImageEnVect.GetObjFromIndex(i);
if ImageEnVect.IsSelObject(iHObj) then
begin
iLeft := ImageEnVect.ObjLeft[iHObj];
iTop := ImageEnVect.ObjTop[iHObj];
iX := ImageEnVect.XScr2Bmp(iLeft);
iY := ImageEnVect.YScr2Bmp(iTop);
iWidth := ImageEnVect.XScr2Bmp(ImageEnVect.ObjWidth[iHObj]);
iHeight := ImageEnVect.YScr2Bmp(ImageEnVect.ObjHeight[iHObj]);
iX2 := iX + iWidth;
iY2 := iY + iHeight;
ImageEnVect.UnSelObject(iHObj);
ImageEnVect.Select(iX, iY, iX2, iY2, iespReplace);
ImageEnVect.UnLockUpdate;
end;
Exit;
end;
end;
end;
end;
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development