![]() |
Re: Labels in ein Array?
FindComponent ist in der Unit Classes enthalten.
|
Re: Labels in ein Array?
muss ich dann irgendwas davorschreiben?
classes.findcomponent oder sowas? |
Re: Labels in ein Array?
Unter
Code:
sollte u.a. dies zu finden sein:
interface
uses classes |
Re: Labels in ein Array?
ist es auch und da steht finccomponent auch drin aber er sagt trotzdem
[Error] Unit1.pas(202): Undeclared identifier: 'findcomponent' |
Re: Labels in ein Array?
Dann poste mal bitte deinen entsprechenden Code.
|
Re: Labels in ein Array?
Delphi-Quellcode:
procedure sichtbareTageeins;
var i: Integer; Procedure tagsichtbar(Mytag: Tlabel); begin If Mytag.Visible Then Form1.Memo2.lines.Add(Mytag.name); end; begin for i := 1 to 7 do tagsichtbar(findcomponent('Label'+inttostr(i)) as TLabel); end; das was nightsahde schon gepostet hat |
Re: Labels in ein Array?
Ich habe das jetzt mal getestet und so geht's definitiv:
Delphi-Quellcode:
Weiß nicht, was du sonst noch anders hast?
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var i: Integer; procedure tagsichtbar(Mytag: TLabel); begin if Mytag.Visible then Form1.Memo2.Lines.Add(Mytag.name); end; begin for i := 1 to 4 do begin tagsichtbar(FindComponent('Label'+inttostr(i)) as TLabel); end; end; end. |
Re: Labels in ein Array?
das geht bei mir auch wenn ich das in nen neues formular schreibe aber wnn ich in das alte reinschreibe dann sagt er
[Error] Unit1.pas(202): Undeclared identifier: 'findcomponent' ich versteht das nich °_^ |
Re: Labels in ein Array?
so hab ma gestestet wenn ich in mein formular nen button reinmache und das reinschreibe dann meckert er nich
aber bei der prozedur oben schon WIESO? 8[ |
Re: Labels in ein Array?
Dann poste doch mal den kompletten Interface Teil (die Komponentenaufzählung kannst du ja was kürzen) und den relevanten Implementation Teil.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:23 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