想把被选中的checklistbox中的选项,赋给combobox,可能有多个。可否不用循环,点击选项的时候可否得到选项的文本内容,
取得文本内容赋给combobox。谢谢!

解决方案 »

  1.   


    procedure TForm1.CheckListBox1ClickCheck(Sender: TObject);
    begin
      Combobox1.Items.Add(CheckListBox1.Items[ CheckListBox1.ItemIndex]);
    end;
      

  2.   

    我用showmessage能把选项显示出来,很大的进步了,但在取消选项时也显示了选项的内容。
    再个就是用add不能看到combobox中的内容。谢谢你了
      

  3.   

    procedure TForm1.CheckListBox1ClickCheck(Sender: TObject);
    begin
      if CheckListBox1选中状态 then
      Combobox1.Items.Add(CheckListBox1.Items[ CheckListBox1.ItemIndex]);
    end;
      

  4.   


    //不知道你要的取消是不是这个意思
    procedure TForm1.CheckListBox1ClickCheck(Sender: TObject); 
    begin 
      if CheckListBox1.Items.checked=ture then 
       Combobox1.Items.Add(CheckListBox1.Items[ CheckListBox1.ItemIndex]); 
      else
       for i=0 to Combobox1.items.count-1 do
       begin
        if CheckListBox1.Items.Strings[CheckListBox1.ItemIndex]=Combobox1.Items.string[i] then  ComboBox1.Items.Delete(i);
       end;
    end;