unit1.pas 873 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. unit Unit1;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5. Classes, SysUtils, Forms, Controls, Graphics, Dialogs, CheckLst, StdCtrls,
  6. BCCheckComboBox;
  7. type
  8. { TForm1 }
  9. TForm1 = class(TForm)
  10. BCCheckComboBox1: TBCCheckComboBox;
  11. Button1: TButton;
  12. procedure Button1Click(Sender: TObject);
  13. procedure FormCreate(Sender: TObject);
  14. private
  15. public
  16. end;
  17. var
  18. Form1: TForm1;
  19. implementation
  20. {$R *.lfm}
  21. { TForm1 }
  22. procedure TForm1.FormCreate(Sender: TObject);
  23. begin
  24. end;
  25. procedure TForm1.Button1Click(Sender: TObject);
  26. var
  27. s: String = '';
  28. i: integer;
  29. begin
  30. for i:=0 to BCCheckComboBox1.Items.Count-1 do
  31. begin
  32. if (BCCheckComboBox1.ListBox.Checked[i]) then
  33. s += BCCheckComBoBox1.Items[i] + LineEnding;
  34. end;
  35. if (s = '') then
  36. ShowMessage('No one is checked')
  37. else
  38. ShowMessage('Checked items: ' + LineEnding + s);
  39. end;
  40. end.