[Lazarus] checklistbox: row checked, count row checked, enumerator and loop

Sven Barth pascaldragon at googlemail.com
Sun Dec 19 11:52:27 CET 2010

On 19.12.2010 11:10, ugaciaka wrote:
> Hi,
> 1. in checlistbox component existing property o function that show
> total row checked?

No, that's not possible. You need to do this manually.

> 2. if  possibile show if a  row is checked if used enumerator (without
> using checlistbox.checked[i] in if statment)? I use enum :=
> checlistbox.items.getenumerator and in a loop while enum.movenext but
> existing a property in enum.getcurrent for show if a item is checked?

No, you can't do that either, because you need the index of the item.

The problem is (as well in your first question) that "Checked" is 
maintained inside the listbox control itself and not inside the item list.

As a side note: You do not need to use "GetEnumerator", "MoveNext" and 
"GetCurrent" directly. Just use a "for-in" loop:

   s: String;
   for s in CheckListBox1.Items do begin
     // do something with "s"


More information about the Lazarus mailing list