比如,第一个combox里选择 电脑配件 ,第二个combox里有 x,y,z,q 4项,怎么不用鼠标,用设置好的键盘热件(比如 x 键 表示选择x,) 就可以选择了?谢谢各位了!谢谢,急得要命

解决方案 »

  1.   

    你可以响应键盘按键呀
    如果KEY=‘X’就让COMBOBOX2。ITEMINDEX:=0;
      

  2.   

    Form1.KeyPreview := True;procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
    begin
      if (ComboBox1.Text = '电脑配件') and (Ord(Key) = 120) then
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
         (ComboBox1.ItemIndex = the index of 电脑配件') // better
      begin
        Key := #0;
        ComboBox2.ItemIndex := 0;
      end;
    end;
      

  3.   

    ComboBox2 的每一项都以你需要的热键字母开头,它的 Style 属性设置为 csDropDownList。然后:procedure TForm1.ComboBox1Select(Sender: TObject);
    begin
      ComboBox2.SetFocus;
    end;
      

  4.   

    你是不是要的是这种效果呀!!源码如下:
    procedure TForm1.ComboBox1Change(Sender: TObject);
    var
    i:integer;
    begin
    i:=combobox1.Items.IndexOf(combobox1.Text);
    if i>0 then
    combobox1.AutoDropDown:=true;
    combobox1.Text:=combobox1.Items[i];
    end;
      

  5.   

    顶楼的可以用,但显然 hiflower(花) 的更值得一试,呵呵