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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to NOT remove the background image with LayersRemove?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

933 Posts

Posted - Nov 07 2021 :  11:43:56  Show Profile  Reply
ImageEnView1.LayersRemove(LYR_SELECTED_LAYERS) sometimes (randomly) removes the BACKGROUND IMAGE together with the selected layer(s).

How can I avoid this?

I now use this workaround to remove the selected layer(s) without removing the background image:

for var i := ImageEnView1.LayersCount - 1 downto 1 do
begin
  if ImageEnView1.Layers[i].Selected then
    ImageEnView1.LayersRemove(i);
end;

This works. But isn't there a built-in method to achieve this?

xequte

38616 Posts

Posted - Nov 07 2021 :  22:09:54  Show Profile  Reply
Hi

Does ImageEnView1.Layers[0].Selectable = False?
Is loAllowMultiSelect in ImageEnView1.LayerOptions?



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

933 Posts

Posted - Nov 08 2021 :  08:13:11  Show Profile  Reply
imgMain.Layers[0].Selectable := False
This seems to block the creation of any selection on the background image (!)

Yes, loAllowMultiSelect is included.
Go to Top of Page

xequte

38616 Posts

Posted - Nov 08 2021 :  17:53:44  Show Profile  Reply
Hi Peter

If imgMain.Layers[0].Selectable = False, you can still make a selection (miSelect) on the background image, but you have to make it the active layer with code. If it is selectable then it is at risk of being removed using LayersRemove(LYR_SELECTED_LAYERS).

You can add loProtectBackground to LayerOptions which will protect it from user actions, such as the Delete key. For the next beta, that will also protect it in the case of LayersRemove(LYR_SELECTED_LAYERS).


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

933 Posts

Posted - Nov 08 2021 :  19:26:40  Show Profile  Reply
Thank you!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: