Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Funktion geht nicht über FindComponent (https://www.delphipraxis.net/24639-funktion-geht-nicht-ueber-findcomponent.html)

jAcK oRsEn 23. Jun 2004 19:35


Funktion geht nicht über FindComponent
 
Wieso geht das so nicht? wenn rechts = 3 und sender = image2 ist! und

Delphi-Quellcode:
begin
tImage(FindComponent('image'+rechts)).Picture := (sender as TImage).picture;
(sender as TImage).picture := nil;
end;
Aber so

Delphi-Quellcode:
begin
image3.Picture := image2.picture;
image2.picture := nil;
end;

Steve 24. Jun 2004 08:15

Re: Funktion geht nicht über FindComponent
 
Haste mal beim Debuggen geprüft, ob Sender wirklich vom Typ TImage ist?
Mehr fällt mir spontan auch nich ein :|

edit: da oben steht ja, dass sender=image2 ist :roll: mein fehler... wer lesen kann... :mrgreen:
Stephan

easywk 24. Jun 2004 08:39

Re: Funktion geht nicht über FindComponent
 
Hallo.
Zitat:

Delphi-Quellcode:
FindComponent('image'+rechts)).Picture

Die Frage ist, was für ein Typ ist rechts? Oben schreibst du rechts wäre 3, als String? Wenn rechts eine Zahl ist dann musst du folgendes machen:
Delphi-Quellcode:
begin
tImage(FindComponent('image'+IntToStr(rechts))).Picture := (sender as TImage).picture;
(sender as TImage).picture := nil;
end;
cu easywk


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