Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Label1.caption[1] ändern? (https://www.delphipraxis.net/19906-label1-caption%5B1%5D-aendern.html)

Nicolai1234 10. Apr 2004 18:27


Label1.caption[1] ändern?
 
Ich möchte gern das erste Zeichen eines Labels ändern, doch
Delphi-Quellcode:
 Label1.caption[1] := 'x'
geht nicht!!!
Wie kann ich es dann machen?

mirage228 10. Apr 2004 18:29

Re: Label1.caption[1] ändern?
 
Delphi-Quellcode:
  Label1.caption[1] := 'x';
mfG
mirage228

Nicolai1234 10. Apr 2004 18:31

Re: Label1.caption[1] ändern?
 
Das ist schon klar geht aber trotzdem nicht! x könnte ja auch ein string sein.

himitsu 10. Apr 2004 18:32

Re: Label1.caption[1] ändern?
 
Mit Caption geht das nicht !!!

Delphi-Quellcode:
Label1.Caption := x + Copy(Label1.Caption, 2, Length(Label1.Caption));

mirage228 10. Apr 2004 18:37

Re: Label1.caption[1] ändern?
 
Zitat:

Zitat von himitsu
Mit Caption geht das nicht !!!

Doch. Dabei muss x aber vom Typ Char sein.

mfG
mirage228

sakura 10. Apr 2004 18:40

Re: Label1.caption[1] ändern?
 
Zitat:

Zitat von mirage228
Doch. Dabei muss x aber vom Typ Char sein.

Nein, es geht generell nicht mit String-Properties. Das liegt an den Getter- und Setter-Methoden. Da helfen nur Workarounds (z.B. der von himitsu)

...:cat:...

himitsu 10. Apr 2004 18:42

Re: Label1.caption[1] ändern?
 
Liste der Anhänge anzeigen (Anzahl: 1)
Zitat:

Zitat von mirage228
Zitat:

Zitat von himitsu
Mit Caption geht das nicht !!!

Doch. Dabei muss x aber vom Typ Char sein.

mfG
mirage228


Nein!!!

[ADD] (siehe Sakura ^^)


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