TLama

Untitled

Jan 28th, 2014
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. type
  2.   TCheckListBoxHelper = class helper for Vcl.CheckLst.TCheckListBox
  3.   public
  4.     procedure GetCheckedItems(List: TStringList);
  5.   end;
  6.  
  7. implementation
  8.  
  9. { TCheckListBoxEx }
  10.  
  11. procedure TCheckListBoxHelper.GetCheckedItems(List: TStringList);
  12. var
  13.   I: Integer;
  14. begin
  15.   List.Clear;
  16.   for I := 0 to Items.Count - 1 do
  17.     if Checked[I] then
  18.       List.Add(Items[I]);
  19. end;
  20.  
  21. procedure TForm1.Button1Click(Sender: TObject);
  22. var
  23.   CheckedItems: TStringList;
  24. begin
  25.   CheckedItems := TStringList.Create;
  26.   try
  27.     CheckListBox1.GetCheckedItems(CheckedItems);
  28.     // so something with CheckedItems
  29.   finally
  30.     CheckedItems.Free;
  31.   end;
  32. end;
Advertisement
Add Comment
Please, Sign In to add comment