假设数据库里有数据  ABC 
                    123
DBLookupComboboxEh1绑定好后
                   输入A 就自己填充ABC 
我想禁止此功能,找不到autocomplete  属性  
请问谁有办法
100分到 http://community.csdn.net/Expert/topic/4103/4103334.xml?temp=.4591486另外20分到http://community.csdn.net/Expert/topic/4071/4071098.xml?temp=.489773

解决方案 »

  1.   

    推荐:不使用数据感知的DBLookupCombobox组件,自己生成一个ComboBox,然后自己处理数据更新!
      

  2.   

    给楼主提个醒 :TCustomDBLookupComboboxEh = class(TCustomDBEditEh, ILookupGridOwner)
    这是类的定义,在单元 DBLookupEH.pas 中
    其中该类定义如下消息过程,分别响应 WMChar 和 WMKeyDown 方法:
    楼主仔细看一下其中都有  LocateStr 函数(我已标出),你要找的就是它了。
    下一贴继续:
    procedure TCustomDBLookupComboboxEh.WMChar(var Message: TWMChar);
      function SpecialKey: Boolean;
      begin
        Result := (Message.CharCode = VK_DELETE) or
          ([ssCtrl, ssAlt] * KeyDataToShiftState(Message.KeyData) <> []);
      end;
    var OldSelStart: Integer;
    begin
      inherited;
      if (Style = csDropDownEh) and not SpecialKey and not (Message.CharCode = 0) then
        if not ((SelStart = Length(Text)) and (SelLength = 0)) or (Message.CharCode = VK_BACK) then
        begin
          OldSelStart := SelStart;
          if LocateStr(Text, False) then   //<<---就是它
          begin
            SelStart := Length(Text);
            SelLength := OldSelStart - SelStart;
          end;
        end else
          ProcessSearchStr('');
    end;
    procedure TCustomDBLookupComboboxEh.WMKeyDown(var Message: TWMKeyDown);
    var OldSelStart: Integer;
    begin
      if (Style = csDropDownEh) and (Message.CharCode = VK_DELETE) then
      begin
        FDataLink.Edit;
        inherited;
        OldSelStart := SelStart;
        if LocateStr(Text, False) then   //<<---就是它
        begin
          SelStart := Length(Text);
          SelLength := OldSelStart - SelStart;
        end;
      end
      else inherited;
    end;
      

  3.   

    继续上一贴:
    这是上面提到的这个函数的实现:
    下面改过的部分我已经标出:function TCustomDBLookupComboboxEh.LocateStr(Str: String; PartialKey: Boolean): Boolean;
    var Options: TLocateOptions;
      CurOnChangeEvent: TNotifyEvent;
    begin
      Result := False;
      if not FListActive or not CanModify(True) then Exit;
      if PartialKey then
        Options := [loCaseInsensitive, loPartialKey]
      else
        Options := [loCaseInsensitive];
      try
        Result := FListLink.DataSet.Locate(FListField.FieldName, Str, Options);
        if Result then
        begin
          FTextBeenChanged := False;
          CurOnChangeEvent := OnChange;
          OnChange := HookOnChangeEvent;
          SetKeyValue(FListLink.DataSet.FieldValues[FKeyFieldName]);
          SetEditText(FListField.DisplayText);  //<---就是它了,你可以把它注释掉,或者再外面干脆就不执行这个函数就行了。
          SelStart := Length(Text);
          SelLength := Length(Str) - SelStart;
          OnChange := CurOnChangeEvent;
          if FTextBeenChanged and Assigned(OnChange) then
            OnChange(Self);
        end else if Style = csDropDownEh then
          SetKeyValue(Null);
      except
        { If you attempt to search for a String larger than what the field
          can hold, and exception will be raised.  Just trap it and
          reset the SearchText back to the old value. }
        if Style = csDropDownListEh then
        begin
          SetEditText(Text);
          SelStart := Length(Text);
          SelLength := Length(Text) - SelStart;
        end else
          SetKeyValue(Null);
      end;
    end;
      

  4.   

    cnmaxu(Max)  问题已经解决,谢谢.原以为要改很多,就一句就行了. 去其它地方接分吧