![]() |
Re: TLabel + taRightJustify = katastrophe?
Das ist ein intelligentes Feature der IDE und kann zur Laufzeit ja nicht verfügbar sein.
|
Re: TLabel + taRightJustify = katastrophe?
Zitat:
[edit]Hier mein ganzer Code (bis auf die Deklaration von l und den Standardkram von Delphi):
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin l.Caption := l.Caption + 'A'; end; procedure TForm1.FormCreate(Sender: TObject); begin l := tLabel.Create(self); l.Left := 300; // l.Width := 300; // l.AutoSize := false; l.Alignment := taRightJustify; l.Parent := Self; l.Top := 3; l.Caption := 'Hallo Welt'; Showmessage(IntToStr(l.Left)); end; |
Re: TLabel + taRightJustify = katastrophe?
Bei Ausrichtung rechts wird bei AutoSize auf der linken vergrößert/verkleinert
|
Re: TLabel + taRightJustify = katastrophe?
Irgendwas passt da aber nicht. Zumindest bei mir steht das Label zu weit rechts. Kontrolle mit einer Line bei 300.
Delphi-Quellcode:
var l: TLabel;
procedure TForm1.Button1Click(Sender: TObject); begin l.Caption := l.Caption + 'A'; end; procedure TForm1.FormCreate(Sender: TObject); begin l := tLabel.Create(self); l.Alignment := taRightJustify; l.Left := 300; l.Parent := Self; l.Top := 3; l.Caption := 'Hallo Welt'; end; procedure TForm1.FormPaint(Sender: TObject); begin Canvas.Pen.Color := clRed; Canvas.MoveTo(300,0); Canvas.LineTo(300,Height); end; procedure TForm1.FormDestroy(Sender: TObject); begin l.Free; end; |
Re: TLabel + taRightJustify = katastrophe?
Zitat:
So will ichs ja: Problem ist nur, dass er es im Create nicht so richtig will xD [edit] WANTED ------ REDBOX ------ ^^ Also DeddyH: Gucks dir beim Panel an. Panel1.Left ist 300. Und l.Left ist 317 (so im Dreh), also höher, weil l.Left + l.Width viel zu hoch ist, und eigentlich 300 ergeben sollte.[/edit] |
Re: TLabel + taRightJustify = katastrophe?
Dann mach es besser in .Loaded()
|
Re: TLabel + taRightJustify = katastrophe?
Zitat:
|
Re: TLabel + taRightJustify = katastrophe?
Weil man im onCreate keine Eigenschaften von Objekten setzen sollte, welche auch in der Dfm stehen, da diese dann mit denen überschrieben werden. Diese setzt man in der .Loaded-Methode, welche nach dem Laden der persistenten Eigenschaften aufgerufen wird.
|
Re: TLabel + taRightJustify = katastrophe?
|
Re: TLabel + taRightJustify = katastrophe?
manches setzt sich halt irgendwie im Gedächnis fest. :oops:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:27 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz