To samo co tu tylko zamiast CheckListBoxa użyć ComboBoxa
procedure TForm1.AddDescription();
var
I, J, k: Integer;
lExpressions: TExpressionsArray;
lExpr: TExpression;
languageOK, categoryOk, descriptionOk: Boolean;
begin
self.LabelExpression.Caption := 'Wyrażenie :';
if assigned(self.ClientDataSet1) then
freeandnil(self.ClientDataSet1);
LoadImage('foo', self.ImageExpression);
lExpressions := self.idictionary.expressionsArray;
ListBox1.Items.BeginUpdate;
try
ListBox1.Items.Clear;
for I := 0 to high(lExpressions) do
begin
languageOK := false;
categoryOk := false;
descriptionOk := false;
lExpr := lExpressions[I];
for J := 0 to CheckListBox1.Items.Count - 1 do
begin
if CheckListBox1.Checked[J] then
begin
if TCategory(CheckListBox1.Items.Objects[J]).CategoryId = lExpr.CategoryId then
begin
categoryOk := true;
Break;
end;
end;
end;
for J := 0 to CheckListBox2.Items.Count - 1 do
begin
if CheckListBox2.Checked[J] then
begin
for k := 0 to lExpr.wordsList.Count - 1 do
if TLanguage(CheckListBox2.Items.Objects[J]).code = Tword(lExpr.wordsList.Objects[k]).languagaeCode then
begin
languageOK := true;
Break;
end;
end;
end;
if trim(self.Edit1.Text) <> '' then
descriptionOk := (pos(uppercase(trim(self.Edit1.Text)), uppercase(lExpr.description)) <> 0)
else
descriptionOk := true;
if categoryOk and languageOK and descriptionOk then
self.ListBox1.Items.Addobject(lExpr.description, lExpr);
end;
if assigned(self.ClientDataSet1) then
freeandnil(self.ClientDataSet1);
if self.ListBox1.Items.Count > 0 then
begin
self.ListBox1.ItemIndex := 0;
self.AddTable();;
end;
finally
ListBox1.Items.EndUpdate;
end;
end;