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
 trying to copy (duplicate) a layer

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
nwscomps Posted - Sep 17 2018 : 03:15:45
procedure TForm1.CopyLayer1Click(Sender: TObject);
begin
  fCopyIELayer.Assign(fCurrentIEView.CurrentLayer);
end;

procedure TForm1.Paste1Click(Sender: TObject);
begin
  fCurrentIEView.LayersCurrent := fCurrentIEView.LayersAdd(fCopyIELayer.Kind);
  fCurrentIEView.CurrentLayer.Assign(fCopyIELayer);
end;


I am trying this code to duplicate a layer with copy and paste, but what I get in the end is always an empty layer (no matter the kind).
Any clue on this one?
Thanks

Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Oct 03 2018 : 19:01:15
Hi Francesco

You cannot use assign to change the type of a class (at least I cannot think of any way in Delphi that it would be possible).

In 8.1.1 we made it possible for you to store a layer as a generic TIELayer and to assign that to other layers, but you still cannot change the type of that layer.

Instead you should remove the current layer and then create a new one using your generic TIELayer, something like.

idx := ImageEnView1.LayersCurrent;
ImageEnView1.LayersRemove( idx );
ImageEnView1.LayersInsert( idx, fStoredLayer );

(Note: You cannot remove layer 0)

Nigel
Xequte Software
www.imageen.com
nwscomps Posted - Oct 03 2018 : 10:32:05
Hello Nigel,
I tried with v.8.1.1 to assign an image layer to a text layer. It still does not work. After assigning it remains an image layer. I thought this was fixed in the new version.

Francesco Savastano
Add-ons for the ImageEn Library
web: http://www.fssoft.it/delphicomps.html
xequte Posted - Sep 17 2018 : 21:58:19
Hi Francesco

The problem is that fCopyIELayer is a TIELayer, but in TIELayer.Assign it checks the class. So you need to typecast the TIELayer.

I will improve this for 8.1.1. You can email me for the updated source.

Nigel
Xequte Software
www.imageen.com
nwscomps Posted - Sep 17 2018 : 07:54:31
Hi Nigel, please try the code I gave. It does not matter the kind of layer I copy I always end up with an empty layer.
I also tried your suggestion, same result.

You asked what kind of layer it is, I create it with this code;

fCopyIELayer := TIELayer.Create(nil);

Then when user hits copy follows:

fCopyIELayer.Assign(fCurrentIEView.CurrentLayer);
//here the kind should determined by the assign method
Then on paste:
//I create a layer of the same kind
fCurrentIEView.LayersCurrent := fCurrentIEView.LayersAdd(fCopyIELayer.Kind);
//I assign my copy to it
fCurrentIEView.CurrentLayer.Assign(fCopyIELayer);


Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library
xequte Posted - Sep 17 2018 : 06:12:33
Hi Francesco

You can simply use:

fCurrentIEView.LayersAdd( SomeLayer );

Nigel
Xequte Software
www.imageen.com