I have a few TIWCGJQCheckBoxList components that I load up with anywhere between 4 and 20 .Items. The Items[x].Selected value is set from data out of a database with LoadSecurityProfiles(), which in turn calls LoadSecurityProfile for each TIWCGJQCheckBoxList component:
- Code: Select all
procedure TframeEditSecurityProfile.LoadSecurityProfiles;
begin
Self.LoadSecurityProfile(C_SECURITY_PROFILE_CASE_FILE, Self.checkListCaseFileOptions);
Self.LoadSecurityProfile(C_SECURITY_PROFILE_EMAIL, Self.checkListEmailOptions);
end;
procedure TframeEditSecurityProfile.LoadSecurityProfile(SecurityProfileIndex: Integer; CheckBoxList: TIWCGJQCheckBoxList);
var
strCode, strSecurityCode: String;
i: Integer;
begin
strSecurityCode := Self.FADOData.FieldByName('security_code').AsString;
strCode := S2Snax.GetToken(strSecurityCode,SecurityProfileIndex,';');
SetLength(strCode, CheckBoxList.Items.Count);
CheckBoxList.Disable;
for i := 0 to CheckBoxList.Items.Count - 1 do
CheckBoxList.Items[i].Selected := (strCode[i+1] = 'Y');
CheckBoxList.Enable;
end;
After the above code, the check list box displays correctly, with each of the .Items showing checked or not checked as expected.
If I DO NOT click on the checkboxlist to change the checkbox of an .Item, when I run this code:
- Code: Select all
function TframeEditSecurityProfile.GetSecurityProfileCode(CheckBoxList: TIWCGJQCheckBoxList): String;
var
strCode: String;
i: Integer;
begin
strCode := '';
for i := 0 to CheckBoxList.Items.Count - 1 do
strCode := strCode + S2Snax.Iif(CheckBoxList.Items[i].Selected, 'Y', 'N');
Result := strCode + ';';
end;
The result from the above function is always a string like 'NNNNNNNNNNNNNNNNNNNN;'
On the other hand, if I DO click on any item in the list to check/uncheck it, the string returned is a correct representation of the items that are checked or unchecked... like 'YYYYYNNNYNNNYYYNYYNY;'
I can, of course, set a variable that will indicate whether or not the user has actually clicked, but it seems like a bug.
Is there a property that I need to set after I load the checkboxlist with .Items so that it will "know" that the LoadSecurityProfile function (above) was executed?
Scratching my head...
Thanks,
Scott