I'm using the TcheckListBox control and would like to use a second column on this, but besides the Columns and Header properties, I could not find any source on inserting the multicolumn contents...
It can look like a noobie question, but Delphi's help doesn't have any content on this, and my searches (on Google and SO) brought much garbage...
I just need an example.
This is not possible using a TCheckListBox
.
But you could use a TListView
.
Set the ViewStyle
property to vsReport
and Checkboxes
to True
.
To create the columns and add the items:
procedure TFormMain.Button1Click(Sender: TObject);
var
Item1, Item2: TListItem;
begin
ListView1.Columns.Add.Caption := 'aa';
ListView1.Columns.Add.Caption := 'bb';
Item1 := ListView1.Items.Add;
Item1.Caption := 'item1';
Item1.SubItems.Add('subitem1');
Item2 := ListView1.Items.Add;
Item2.Caption := 'item2';
Item2.SubItems.Add('subitem2');
Item2.Checked := True;
end;
Looks like:
list view with checkboxes http://img638.imageshack.us/img638/4681/clipboard01y.png
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With