秋·风

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
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 2024-08-29 18:03  秋·风  阅读(109)  评论(0编辑  收藏  举报