[Lazarus] Visual "uglyness" when creating TSynEdit @ runtime in my app

luiz americo pereira camara luizmed at oi.com.br
Sat Jan 5 11:54:23 CET 2013


2013/1/5 luiz americo pereira camara <luizmed at oi.com.br>:
> 2013/1/5 luiz americo pereira camara <luizmed at oi.com.br>:
>> 2013/1/5 Mattias Gaertner <nc-gaertnma at netcologne.de>:
>>> On Sat, 05 Jan 2013 08:32:54 +0000
>>> Martin <lazarus at mfriebe.de> wrote:
>>>> and therefore finally
>>>>
>>>>    s:=PageControl1.AddTabSheet;
>>>>    PageControl1.ActivePage := s;  // paint tabsheet
>>>>    l := TSynEdit.Create(self);
>>>>    l.Parent := s;                               // paint scrollbars, not
>>>> yet aligned
>>>>    l.Align := alClient;                      // paint scrollbars
>>>> (again), this time aligned. Since synedit itself does not yet paint, the
>>>> previous painted scrollbars remain a visible image
>>>
>>> It seems the Win32 intf triggers immediate paints.
>>> Maybe some win32 developer can explain why.
>>>
>
> I've found a suspect.
>
> SetParent triggers the handle creation
> TSynEdt.CreateWnd calls SizeOrFontChanged that calls UpdateScrollBars
> Here, since PaintLock <> 0 the scrollbar change is postponed
>
> Martin/Bart, can you check if you pass the check for PaintLock in
> UpdateScrollBars?
>
> Alternatively comment the call to SizeOrFontChanged in CreateWnd and
> see what happens
>

More info:

SynEdit.CreateHandle -> DoDecPaintLock -> UpdateScrollBars ->
ShowScrollBar (LCL) -> ShowScrollBar (Win32) -> Windows.RedrawWindow

Luiz




More information about the Lazarus mailing list