richmemo: win32, remove the limitation to default (32K or 64K) characters, when MaxLength of RichMemo is set to 0. The issue reported by TraumTaenzerDieter on the forum.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4617 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2016-04-12 00:44:04 +00:00
parent d24bf8307f
commit 51a647988c

View File

@ -81,6 +81,8 @@ type
class procedure SetTextAttributes(const AWinControl: TWinControl; TextStart, TextLen: Integer;
const Params: TIntFontParams); override;
class procedure SetHideSelection(const ACustomEdit: TCustomEdit; AHideSelection: Boolean); override;
class procedure SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
class function GetStyleRange(const AWinControl: TWinControl; TextStart: Integer; var RangeStart, RangeLen: Integer): Boolean; override;
class procedure SetTextUIParams(const AWinControl: TWinControl; TextStart, TextLen: Integer;
@ -524,8 +526,12 @@ begin
eventmask := eventmask or ENM_SELCHANGE or ENM_LINK;
SendMessage(AWinControl.Handle, EM_SETEVENTMASK, 0, eventmask);
// Limitless text. However, the value would be overwritten by a consequent
// SetMaxLength call, see above.
SendMessage(AWincontrol.Handle, EM_EXLIMITTEXT, 0, LParam(-1));
// memo is not a transparent control -> no need for parentpainting
PArams.WindowInfo^.ParentMsgHandler := @RichEditNotifyProc;
Params.WindowInfo^.ParentMsgHandler := @RichEditNotifyProc;
Params.WindowInfo^.needParentPaint := false;
Result := Params.Window;
end;
@ -628,6 +634,22 @@ begin
RichEditManager.SetHideSelection(ACustomEdit.Handle, AHideSelection);
end;
class procedure TWin32WSCustomRichMemo.SetMaxLength(
const ACustomEdit: TCustomEdit; NewLength: integer);
var
winhandle: HWND;
relen : Integer;
begin
winhandle := ACustomEdit.Handle;
// By default NewLength=0. For RichEdit that means 64K or 32K limitation.
// Which makes no sense and isn't cross platform!
// RichMemo assumes NewLength=0 as limitless
if NewLength=0 then relen:=-1 // limitless
else relen:=NewLength;
SendMessage(winhandle, EM_EXLIMITTEXT, 0, LParam(relen));
GetWin32WindowInfo(winhandle)^.MaxLength := NewLength;
end;
procedure InitScrollInfo(var info: TScrollInfo);
begin
FillChar(info, sizeof(info), 0);