Try this to move object or selection:
procedure TFormMain.ImageEnVect1SpecialKey( Sender: TObject; CharCode: Word; Shift: TShiftState; var Handled: Boolean );
var
i: integer;
begin
// Is any object selected
if ImageEnVect1.SelObjectsCount > 0 then
begin
// Move all selected objects
for i := 0 to ImageEnVect1.SelObjectsCount - 1 do
begin
// if object(s) is/are selected move the object(s)
if ImageEnVect1.IsSelObject( i ) then
begin
case CharCode of
vk_Left:
begin
ImageEnVect1.ObjLeft[ i ] := ImageEnVect1.ObjLeft[ i ] - 1;
end;
vk_Down:
begin
ImageEnVect1.ObjTop[ i ] := ImageEnVect1.ObjTop[ i ] + 1;
end;
vk_Right:
begin
ImageEnVect1.ObjLeft[ i ] := ImageEnVect1.ObjLeft[ i ] + 1;
end;
vk_Up:
begin
ImageEnVect1.ObjTop[ i ] := ImageEnVect1.ObjTop[ i ] - 1;
end;
end; // case
StatusBar1.Panels[ 0 ].Text := 'Left: ' + IntToStr( ImageEnVect1.ObjLeft[ 0 ] );
StatusBar1.Panels[ 1 ].Text := 'Right: ' + IntToStr( ImageEnVect1.ObjLeft[ 0 ] + ImageEnVect1.ObjWidth[ 0 ] );
StatusBar1.Panels[ 2 ].Text := 'Top: ' + IntToStr( ImageEnVect1.ObjTop[ 0 ] );
StatusBar1.Panels[ 3 ].Text := 'Bottom: ' + IntToStr( ImageEnVect1.ObjTop[ 0 ] + ImageEnVect1.ObjHeight[ 0 ] );
StatusBar1.Panels[ 4 ].Text := 'Width: ' + IntToStr( ImageEnVect1.ObjWidth[ 0 ] );
StatusBar1.Panels[ 5 ].Text := 'Height: ' + IntToStr( ImageEnVect1.ObjHeight[ 0 ] );
end;
end;
end // selected obj
// else if selection move the selection
else if ImageEnVect1.Selected then
begin
case CharCode of
vk_Left:
ImageEnVect1.MoveSelection( -1, 0 );
vk_Down:
ImageEnVect1.MoveSelection( 0, 1 );
vk_Right:
ImageEnVect1.MoveSelection( 1, 0 );
vk_Up:
ImageEnVect1.MoveSelection( 0, -1 );
end;
StatusBar1.Panels[ 0 ].Text := 'Left: ' + IntToStr( ImageEnVect1.SelX1 );
StatusBar1.Panels[ 1 ].Text := 'Right: ' + IntToStr( ImageEnVect1.SelX2 );
StatusBar1.Panels[ 2 ].Text := 'Top: ' + IntToStr( ImageEnVect1.SelY1 );
StatusBar1.Panels[ 3 ].Text := 'Bottom: ' + IntToStr( ImageEnVect1.SelY2 );
StatusBar1.Panels[ 4 ].Text := 'Width: ' + IntToStr( ImageEnVect1.SelX2 - ImageEnVect1.SelX1 );
StatusBar1.Panels[ 5 ].Text := 'Height: ' + IntToStr( ImageEnVect1.SelY2 - ImageEnVect1.SelY1 );
end;
William Miller