[Lazarus] TEdit initial display width

Jürgen Hestermann juergen.hestermann at gmx.de
Sun Nov 20 18:10:21 CET 2016


I have a form Form1 with an TEdit component Edit1 on it.
Edit1 is anchored to Form1 on the left and on the right.
I create the Form and set its width on the fly with the following code:

------------------------------------------------------------------------
Form1 := TForm1.Create(Nil);
with Form1 do
    begin
    Left     := 10;
    Width := 800;
    WindowState := wsNormal;
    with Edit1 do
       begin
       Text := 'Very long text ....... aaaaaaaaaaaaaa bbbbbbbbbbbbbb cccccccccccccc .......... Very long text';
       SelectAll;
       end;
    ShowModal;
    ...
    end;
------------------------------------------------------------------------

In the designer the width of Form1 is about 500
but I set it to the larger width 800 in the code.
Because of the anchoring Edit1 has the same width now.

But still, if the text of Edit1 is longer than 500,
then the initial display shows an offset as if
the width is 500 although there is plenty
of space (800) for the long text.
When moving around with the cursor I can shift
the text to make everything visible but this is not done
directly after ShowModal.

Is this a known bug?
Exists an workaround for it?



More information about the Lazarus mailing list