getlayerstyle setlayerstyle safe way to copy a layer?

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

getlayerstyle setlayerstyle safe way to copy a layer?

Post by Bugala »

As i couldnt find any "CopyLayer" command. I was wondering if this would be a safe way to do it:

Code: Select all

newlayerid = InsertLayer(0, #BRUSH, 1, 1, 1)
t = GetLayerStyle(layertobecopiedID)
SetLayerStyle(newlayerid, t)
Or do i have to take something into consideration, like is there some piece of information missing from layerstyle infos?
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: getlayerstyle setlayerstyle safe way to copy a layer?

Post by airsoftsoftwair »

Hmm, interesting approach. I'm not sure it will work 100% for all layer types, though, although in theory it should. If you have a case where it doesn't work, just post.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: getlayerstyle setlayerstyle safe way to copy a layer?

Post by airsoftsoftwair »

Last but not least:

Code: Select all

- New: Added CopyLayer() command which can be used to make an identical copy of an existing layer; all
  layer attributes are cloned except the layer name (if present) because that must be unique; a new name
  for the layer can be passed in the optional table argument
Post Reply