我在keypress事件中写
 if key=#13 then
    labelededit4.SetFocus;根本没用,只是高亮文本
注意是comboboxex,不是combobox
望各位指点一下;

解决方案 »

  1.   

    在判断key=#13后,做这个动作key:=#0
      

  2.   

    楼上可能没明白我的意思
    我想要在comboboxex中按回车键,把焦点移到下一控件中
      

  3.   

    我那行代码的意思是,让combobox处理不到回车。另外,你不能在keypress里面处理此类按键。应该在keydown事件里面,keypress处理符号、字母、数字的;
    你也可以把 回车 改为tab键,前提是要设定好控件的taborder
      

  4.   

    if key=#13 then
      begin    
        key:=#0;
        SendMessage(Handle,WM_NEXTDLGCTL,0,0);
      end;这样也实现不了
    直接给出代码吧,结贴我再加50分
      

  5.   


    procedure TForm1.ComboBox1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if (key = vk_return) and (shift=[]) then
      begin
        key := 0;
        edit1.SetFocus;
      end;
    end;
      

  6.   

    我弄晕了,我还在keypress里捣鼓,怪不得
    等我明天加分后,再给你一起结
      

  7.   


    1.EDIT中keypress:
      if not (Key in ['0'..'9',#8,#13]) then Key:=#0;
      if Key=#13 then
      begin
        labelededit4.SetFocus; 
      end;
    2.FORM中keypress:(keypreview:true)
      if (key=#13) then
      begin
        Key:=#0;
        Perform(WM_NEXTDLGCTL, 0, 0);
      end;
      

  8.   

    form的keypreiew属性为 true
    在FORM的keypress事件中加入
      if (key=#13) then
      begin
        Key:=#0;
        Perform(WM_NEXTDLGCTL, 0, 0);
      end;
    这个办法管用,我试了.