ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to make a Layer moveable/resizeable in code

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
AndyColmes Posted - Mar 08 2017 : 10:10:02
I have the following code during runtime, but the Layer does not seem to be moveable or resizeable. What settings did I miss to do this? The LAYER_2 is the last added layer in the TImageEnView:

File2VectWindow.LayersCurrent := LAYER_2;
File2VectWindow.LayersSync := False;
File2VectWindow.LayersDrawBox := True;

File2VectWindow.Layers[ LAYER_2 ].VisibleBox := True;
File2VectWindow.Layers[ LAYER_2 ].Selectable := True;
File2VectWindow.Layers[ LAYER_2 ].Locked := False;

File2VectWindow.MouseInteract := [ miRotateLayers, miMoveLayers,
miResizeLayers ];
File2VectWindow.Update;

Thanks in advance.

Andy
2   L A T E S T    R E P L I E S    (Newest First)
AndyColmes Posted - Mar 11 2017 : 23:07:57
Thanks very much Bill for the clarification. I will experiment per your suggestions and see if it works for me.

Andy
w2m Posted - Mar 08 2017 : 10:40:42
Does your layer contain transparency, any pixels with alpha = 0?
If so, you need File2VectWindow.SelectionOptions := File2VectWindow.SelectionOptions + [iesoSelectTranspLayers];

Try creating a simple test project, and add a TImageEnVect and set the TImageEnVect.Align to alClient. Then in the OnFormShow event add this code:

procedure TForm1.FormShow(Sender: TObject);
var
  iLayer: integer;
begin
  ImageEnVect1.LayersSync := False;
  ImageEnVect1.LayersDrawBox := True;
  ImageEnVect1.MouseInteract := [miRotateLayers, miMoveLayers, miResizeLayers];
  iLayer := ImageEnVect1.LayersAdd;
  ImageEnVect1.Layers[iLayer].PosX := 0;
  ImageEnVect1.Layers[iLayer].PosY := 0;
  ImageEnVect1.Layers[iLayer].Width := 200;
  ImageEnVect1.Layers[iLayer].Height := 200;
  ImageEnVect1.Layers[iLayer].VisibleBox := True;
  ImageEnVect1.Layers[iLayer].Selectable := True;
  ImageEnVect1.Layers[iLayer].Locked := False;
  iLayer := ImageEnVect1.LayersAdd;
  ImageEnVect1.Layers[iLayer].PosX := 200;
  ImageEnVect1.Layers[iLayer].PosY := 200;
  ImageEnVect1.Layers[iLayer].Width := 300;
  ImageEnVect1.Layers[iLayer].Height := 300;
  ImageEnVect1.LayersCurrent := iLayer;
  ImageEnVect1.Layers[iLayer].VisibleBox := True;
  ImageEnVect1.Layers[iLayer].Selectable := True;
  ImageEnVect1.Layers[iLayer].Locked := False;
  ImageEnVect1.Update;
end;

Add a TPanel on the form and set align property to alTop and add a TSpeedButton on the panel. Set the buttons name property to Rotate1. Set the buttons AllowAllUp property to true, and set the buttons group index to 1. Then add the following code:
procedure TForm1.Rotate1Click(Sender: TObject);
begin
  if Rotate1.Down then
    ImageEnVect1.MouseInteract := [miRotateLayers]
  else
    ImageEnVect1.MouseInteract := [miMoveLayers, miResizeLayers];
end;

If you enable all layer selection modes ([miRotateLayers, miMoveLayers, miResizeLayers]) then only the central grip is visible and the layer can be rotated and moved but not resized because there are no side or corner grips.
When miRotateLayers is enabled, only a central grip is visible to show the component is in rotateLayers mode. No side grips or corner grips are visible when in miRotateLayersmode so the image can not be resized in this mode. When the miMoveLayers, miResizeLayers mode is enabled, all side and corner grips become visible, but the central grip is removed. When the side grips are visible in the miMoveLayers, miResizeLayers mode the layer can be selected, moved and resized, but not rotated.

Nigel may want to add the above paragraph to the help file to explain how the MouseInteract modes work and which grips are visible in each mode.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development