秋·风

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  278 随笔 :: 0 文章 :: 308 评论 :: 20万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
dbgrideh在linux存在粘贴时重复的Bug,直接给解决方法:
1.打开EhLib.VCL 11.1 xxx/Lazarus/Lib/DBAxisGridsEh.pas
2.定位到function TDBAxisGridInplaceEdit.DoPaste(var Message: TMessage): Boolean; 
添加红字部分代码,重新编译应用就可以。
复制代码
        AAxisBar := Grid.AxisBars[Grid.SelectedIndex];
        ClipboardText := Clipboard.AsText;
        AText := AAxisBar.GetAcceptableEditText(ClipboardText);
        if (MaxLength > 0) and (TextLength(Text) + TextLength(AText) - SelLength > MaxLength) then
          AText := TextCopy(AText, 1, MaxLength - TextLength(Text) + SelLength);
        FSearchText := TextCopy(Text, 1, SelStart) + AText + TextCopy(Text, SelStart + SelLength + 1, MAXINT);
        NewSelStart := TextLength(TextCopy(Text, 1, SelStart) + AText);
        Grid.DataLink.Edit;
        if Grid.Datalink.Editing then
        begin
          {$ifdef mswindows}
          Grid.Datalink.Modified;
          Text := FSearchText;
          SelStart := NewSelStart;
          Grid.FEditText := Text;
          {$endif}
          {$IFDEF FPC_CROSSP}
          {$ELSE}
          SendMessage(Handle, EM_SCROLLCARET, 0,0);
          {$ENDIF}
        end;
      end
      else
        Result := inherited DoPaste(Message);
    end;
  end;
end;
复制代码

 

posted on   秋·风  阅读(156)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示