Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Algorithmen, Datenstrukturen und Klassendesign (https://www.delphipraxis.net/78-algorithmen-datenstrukturen-und-klassendesign/)
-   -   Auf einer manuell erstellen Form wird nichts angezeigt (https://www.delphipraxis.net/169139-auf-einer-manuell-erstellen-form-wird-nichts-angezeigt.html)

mcinternet 2. Jul 2012 09:20

Auf einer manuell erstellen Form wird nichts angezeigt
 
Hallo,

ich erstelle eine Form innerhalb einer Komponente manuell. Ein Button, welchen ich darauf erstelle wird problemlos angezeit, aber weder ein Memo, noch ein StaticText oder Tlabel.
Hier der Quellcode:
Code:
unit ProgInfo;

interface

uses
  Forms, Classes, StdCtrls;




  type
  TFormInfo = class(TForm)

  private
    btn_ok: TButton;
    text_info : TLabel;
    procedure btn_okClick(Sender: TObject);
  public
    constructor create(AOwner : TComponent);
    procedure anzeigen;
  end;

implementation



constructor TFormInfo.create(AOwner : TComponent);
begin
  inherited CreateNew(AOwner);
  btn_ok := TButton.Create(self); // self ist die 'eigene Adresse'
  btn_ok.Left := 192;
  btn_ok.Top := 471;
  btn_ok.Width := 49;
  btn_ok.caption := 'OK';
  btn_ok.parent := self;
  btn_ok.OnClick := btn_okClick; // Zuweisung der Ereignisbehandlung;
  text_info := Tlabel.Create(self);
  text_info.Top := 0;
  text_info.Left := 0;
  text_info.Height := 465;
  text_info.Width := 449;
  text_info.Visible := true;
  text_info.Caption := 'Info!';
end;

procedure TFormInfo.btn_okClick(Sender: TObject);
begin
  close;
end;

procedure TFormInfo.anzeigen;
begin
  text_info.Caption := 'Es sind neue Einstellungen hinzugekommen:';
end;

end.
Ich möchte auf dieser Form einfach nur einen längeren Text (Info) anzeigen.
Da das ganze in einer Komponente statt findet, baue ich dazu kein dfm.

Gruss
mc

TBx 2. Jul 2012 09:26

AW: Auf einer manuell erstellen Form wird nichts angezeigt
 
Du hast vergessen, den Parent Deines Labels zu setzen.

mcinternet 2. Jul 2012 09:30

AW: Auf einer manuell erstellen Form wird nichts angezeigt
 
aaaaahhhh :shock:

vielen Dank!

Gruss

mc


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:09 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz