You've already forked lazarus-ccr
richmemo: forcing handle allocation on set* operations (including load), to make sure that RichMemo system specific operations can be executed, #19662
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2832 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -207,13 +207,15 @@ end;
|
|||||||
procedure TCustomRichMemo.SetTextAttributes(TextStart, TextLen: Integer;
|
procedure TCustomRichMemo.SetTextAttributes(TextStart, TextLen: Integer;
|
||||||
{SetMask: TTextStyleMask;} const TextParams: TFontParams);
|
{SetMask: TTextStyleMask;} const TextParams: TFontParams);
|
||||||
begin
|
begin
|
||||||
if HandleAllocated then
|
if not HandleAllocated then HandleNeeded;
|
||||||
|
if HandleAllocated then
|
||||||
TWSCustomRichMemoClass(WidgetSetClass).SetTextAttributes(Self, TextStart, TextLen, {SetMask,} TextParams);
|
TWSCustomRichMemoClass(WidgetSetClass).SetTextAttributes(Self, TextStart, TextLen, {SetMask,} TextParams);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomRichMemo.GetTextAttributes(TextStart: Integer; var TextParams: TFontParams): Boolean;
|
function TCustomRichMemo.GetTextAttributes(TextStart: Integer; var TextParams: TFontParams): Boolean;
|
||||||
begin
|
begin
|
||||||
if HandleAllocated then
|
if not HandleAllocated then HandleNeeded;
|
||||||
|
if HandleAllocated then
|
||||||
Result := TWSCustomRichMemoClass(WidgetSetClass).GetTextAttributes(Self, TextStart, TextParams)
|
Result := TWSCustomRichMemoClass(WidgetSetClass).GetTextAttributes(Self, TextStart, TextParams)
|
||||||
else
|
else
|
||||||
Result := false;
|
Result := false;
|
||||||
@ -245,6 +247,7 @@ procedure TCustomRichMemo.SetSelText(const SelTextUTF8: string);
|
|||||||
var
|
var
|
||||||
st : Integer;
|
st : Integer;
|
||||||
begin
|
begin
|
||||||
|
if not HandleAllocated then HandleNeeded;
|
||||||
Lines.BeginUpdate;
|
Lines.BeginUpdate;
|
||||||
try
|
try
|
||||||
st := SelStart;
|
st := SelStart;
|
||||||
@ -288,6 +291,8 @@ var
|
|||||||
l : Integer;
|
l : Integer;
|
||||||
p : TFontParams;
|
p : TFontParams;
|
||||||
begin
|
begin
|
||||||
|
if not HandleAllocated then HandleNeeded;
|
||||||
|
|
||||||
if (ModifyMask = []) or (TextLength = 0) then Exit;
|
if (ModifyMask = []) or (TextLength = 0) then Exit;
|
||||||
|
|
||||||
i := TextStart;
|
i := TextStart;
|
||||||
@ -311,6 +316,7 @@ end;
|
|||||||
|
|
||||||
function TCustomRichMemo.LoadRichText(Source: TStream): Boolean;
|
function TCustomRichMemo.LoadRichText(Source: TStream): Boolean;
|
||||||
begin
|
begin
|
||||||
|
if not HandleAllocated then HandleNeeded;
|
||||||
if Assigned(Source) and HandleAllocated then begin
|
if Assigned(Source) and HandleAllocated then begin
|
||||||
Result := TWSCustomRichMemoClass(WidgetSetClass).LoadRichText(Self, Source);
|
Result := TWSCustomRichMemoClass(WidgetSetClass).LoadRichText(Self, Source);
|
||||||
if not Result and Assigned(RTFLoadStream) then begin
|
if not Result and Assigned(RTFLoadStream) then begin
|
||||||
|
Reference in New Issue
Block a user