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;
标签:end,dbgrideh,TextLength,Text,lazarus,Grid,linux,AText,TextCopy From: https://www.cnblogs.com/qiufeng2014/p/18387325