Hi,
I have a TSectionListBox with only one section. How do I check the listbox for each subitem in section[0]? This gives an error with TStringlist out of bounce...
slb.Sections[0].SubItemCheckState[Current] := true;
-Kurt
I checked this with a default TSectionListBox on the form and the following code:
procedure TForm1.Button1Click(Sender: TObject);
begin
if SectionListBox1.Sections[0].SubItemCheckState[1] then
showmessage('checked')
else
showmessage('unchecked')
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
sectionlistbox1.Sections.Clear;
sectionlistbox1.Sections.Add.Caption := 'section 1';
sectionlistbox1.BeginUpdate;
sectionlistbox1.Sections[0].ControlType := scCheckbox;
sectionlistbox1.Sections[0].ReadOnly := false;
sectionlistbox1.Sections[0].SubItems.Add('item 1');
sectionlistbox1.Sections[0].SubItems.Add('item 2');
sectionlistbox1.Sections[0].SubItems.Add('item 3');
sectionlistbox1.EndUpdate;
sectionlistbox1.Sections[0].State := lssExpanded;
end;
and this always shows the correct checkbox state of item 2 in section 1.