Recent

Author Topic: [SOLVED] TRichEdit and HandleAllocated after Create  (Read 3794 times)

Shebuka

  • Sr. Member
  • ****
  • Posts: 429
[SOLVED] TRichEdit and HandleAllocated after Create
« on: July 25, 2011, 02:57:25 pm »
Hi all,
I'm trying to use this component and i'v encountered this behavior:
When i create the form with TRichEdit without showing it and then try to add some strings via .lines.add(MyString); and set some Style via .SetTextAttributes(...) it's not working (the text formatting). It seems to not allocate the Handle until i Show the form:
Code: [Select]
procedure TCustomRichMemo.SetTextAttributes(TextStart, TextLen: Integer; 
  {SetMask: TTextStyleMask;} const TextParams: TFontParams);
begin
  if HandleAllocated then            <- This one is false
    TWSCustomRichMemoClass(WidgetSetClass).SetTextAttributes(Self, TextStart, TextLen, {SetMask,} TextParams);
end;
Is there a way to force handle allocation?
« Last Edit: July 25, 2011, 03:32:00 pm by Shebuka »

Shebuka

  • Sr. Member
  • ****
  • Posts: 429
Re: TRichEdit and HandleAllocated after Create
« Reply #1 on: July 25, 2011, 03:31:50 pm »
solved: after creating the form call .NeedHandle for the component you need the handle.

 

TinyPortal © 2005-2018