Checking the items checked in a CheckListBox
06:18 10 Dec 2015

As my first instance of the question was too broad, I am going to try and reword this so it is more understandable.

I want to be able to change the visibility of a label based on an item in a check box list being checked. I have a loop that goes through my check box list.

procedure TFrmSettings.CheckBoxSelected;
var
i : Integer;
begin
for i := 0 to CblRequiredFields.Items.Count - 1 do
 begin
 if CblRequiredFields.Checked[i] then
  begin
  FrmVReg.ReqFields(CblRequiredFields.Items.Strings[i]);
  end;
 end;
end;

Here is just a part of the ReqFields procedure as it would be too long to put into this Q.

procedure TFrmVReg.ReqFields(ChkStr : String);
begin
if ChkStr = 'Gender' then
 begin
 lblGenderReq.Visible := True;
 end
else
 begin
 lblGenderReq.Visible := False;
 end;

The problem I keep having is I can either only have one label active at one time or have it where a label will not disappear when it is deselected.

I hope I have reworded this to a point that it isn't as broad as the previous question.

delphi