这个自动填充功能当数据出现 aa aaa aaaa 时就会出现aaa 最后一个a删不掉的情况。解决方法就去掉这个自动填充功能。在特定情况可以加快这个控件的速度 打开Dblookupeh.pas 文件一般在 delphi/bin/ 目录下找到 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; ------------- 把if Result then 改为 if False then 再打开原程序,,重新编绎
去掉Dblookupeh控件的自己填充功能
最新推荐文章于 2022-07-03 00:04:19 发布
本文介绍了一种在Delphi应用程序中遇到的自动填充功能问题,即在输入特定字符串时,最后一个字符无法删除。通过禁用自动填充功能,解决了此问题,并详细说明了修改源代码的具体步骤。
7737

被折叠的 条评论
为什么被折叠?



