SHOW:
|
|
- or go back to the newest paste.
| 1 | type | |
| 2 | - | TCheckListBox = class(Vcl.CheckLst.TCheckListBox) |
| 2 | + | TCheckListBoxHelper = class helper for Vcl.CheckLst.TCheckListBox |
| 3 | public | |
| 4 | - | procedure GetCheckedItems(out List: TStrings); |
| 4 | + | procedure GetCheckedItems(List: TStringList); |
| 5 | end; | |
| 6 | ||
| 7 | implementation | |
| 8 | ||
| 9 | - | { TCheckListBox }
|
| 9 | + | { TCheckListBoxEx }
|
| 10 | ||
| 11 | - | procedure TCheckListBox.GetCheckedItems(out List: TStrings); |
| 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; |