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
 Cannot understand why RemoveLayer throws out of bounds error ?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

andyhill

Australia
133 Posts

Posted - Aug 25 2022 :  21:47:53  Show Profile  Reply
I have many text layers

procedure TfMain.ImageEnView1LayerNotifyEx(Sender: TObject; layer: Integer; event: TIELayerEvent);

...

for i:= 0 to ImageEnView1.LayersCount-1 do begin
ALayer:= ImageEnView1.Layers[i];
if ( (ALayer.Locked = False)
and (ALayer.Selected = True)
and (ALayer.Kind = ielkText)
) then begin

do my thing

ImageEnView1.Deselect;
// ImageEnView1.LockUpdate;
ImageEnView1.LayersRemove(i); // throws errors ?
// ImageEnView1.UnlockUpdate;
ImageEnView1.Update();




Andy

kolio

Ukraine
3 Posts

Posted - Aug 26 2022 :  13:36:05  Show Profile  Reply
try
for i:= ImageEnView1.LayersCount-1 downto 0 ....
Go to Top of Page

xequte

38611 Posts

Posted - Aug 28 2022 :  00:20:33  Show Profile  Reply
Yes, as Kolio states. Iterate downward.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: