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
 TImageEnMView Delete Checked Thumbnails

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
w2m Posted - Aug 24 2014 : 09:55:04
if you take the ...multi\checkboxes demo and add a button to the form then add this code to the buttons click event, the checked thumbnails are not deleted. Why? After checking 3 thumbnails, one thumbnail remains checked and is not deleted.

// Delete checked images
procedure TMainForm.DeleteChecked1Click(Sender: TObject);
var
  I: Integer;
begin
  for I := 0 to ImageEnMView1.ImageCount-1 do
    if ImageEnMView1.Checked[I] then
    begin
      ImageEnMView1.DeleteImage(I);
    end;
  ImageEnMView1.Update;
end;


Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Aug 24 2014 : 22:19:15
Hi Bill

If you delete the first item in the list, then the second item becomes the first one, the third item becomes the second one, etc. So if you have deleted some earlier items in the list by the time you get to the end that referenced item would no longer exist.

Either work backwards (for I := ImageEnMView1.ImageCount-1 downto 0 do) or only increment the iteration variable if you do not delete an item.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com