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

luiz americo pereira camara luizmed at oi.com.br
Sat Jan 5 14:01:21 CET 2013


@Bart:

Did you tried to set Visible to false before setting Parent and Align
and then setting visible to True, like below?

  s:=PageControl1.AddTabSheet;
  PageControl1.ActivePage := s;
  l := TSynEdit.Create(self);
  l.Visible := False
  l.Parent := s;
  l.Align := alClient;
  l.Visible := True


Luiz

2013/1/4 Bart <bartjunk64 at gmail.com>:
> Hi,
>
> I have a text editor (LazEdit on Lazarus CCR) which uses a
> TPageControl to act like a Tabbed Document Interface (much like
> Lazarus SE).
>
> Upon creating a new Tab it basically does:
> - Add a new TTabSheet to the PageControl
> - Create an instance of a TSynEdit
> - Set TSynEdit.Parent to the newly created TTabSheet
> - Set TSynEdit.Align := alClient
>
> This works as expected.
> However there is one visual anomaly: when you create a new Tab, for a
> brief moment you can see the TSynEdit, unaligned, with Width and
> Height set to it's defaults (like you would drop it on a Form in
> Lazarus).
>
> Long time ago, in Delphi, I solved this by doing:
>
>   Try
>     LockWindowUpdate(TheHandle);
>     ...
>    //Create the TSynEdit, align it etc.
>
>   Finally
>     LockWindowUpdate(0);
>
> This delayed any painting up to the point the TSynEdit was aligned.
> However, this is a Windows only fix.
>
> The relevant code is at:
> https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/applications/lazedit/editorpagecontrol.pp
> (function TEditorPageControl.AddPage: TEditor; appr. at line 994)
>
> Does anyone have a suggestion how to fix this in a cross-platform manner?
>
> Bart
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




More information about the Lazarus mailing list