Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Caption nicht vorhanden. (https://www.delphipraxis.net/50817-caption-nicht-vorhanden.html)

VT-DA 1. Aug 2005 13:18


Caption nicht vorhanden.
 
Hi,

Ich wollte nun genau das gleiche wie hir machen: http://www.delphipraxis.net/internal...ct.php?t=60350
Aber leider klappt das irgendwie wieder nicht ganz.
Ich möchte das dass Object eine andere Caption kriegt.
Doch irgendwie ist der Befehl nicht vorhanden?
Was kann ich machen oder kennt jemand einen anderen Befehl?

Delphi-Quellcode:
procedure ObjectCaption(Obj: TWinControl;Cap: String);
begin
Obj.Caption := Cap;
end;
Mfg

Zacherl 1. Aug 2005 13:28

Re: Caption nicht vorhanden.
 
Wenn Obj z.B. ein Button ist musst du

Delphi-Quellcode:
TButton(Obj).Caption := Cap;
schreiben

Die Muhkuh 1. Aug 2005 13:34

Re: Caption nicht vorhanden.
 
Hi,

man könnt es höchstens so machen:

Delphi-Quellcode:
procedure ObjCpt(Obj: TObject; const aCaption: String);
begin
  if Obj is TButton then
    TButton(Obj).Caption := aCaption;

  if Obj is TLabel then
    TLabel(Obj).Caption := aCaption;

  if Obj is TEdit then
    TEdit(Obj).Text := aCaption;
end;
Bringt aber nicht wirklich einen Vorteil. Da kann man genausogut einfach Label1.Caption := schreiben.

VT-DA 1. Aug 2005 17:17

Re: Caption nicht vorhanden.
 
Hi,

Ahh. Okay. Danke

Mfg


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:17 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