Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi neue Komponente? (https://www.delphipraxis.net/2667-neue-komponente.html)

nailor 1. Feb 2003 19:17

...und man das eigene Array umbenennen kann. Wen du mit FindComponent arbeitest, wird das nachher ein sehr schöner Spass, die Variabelnamen zu ändern!

Haegar 1. Feb 2003 20:09

hi,
bin j auch noch ein bissel lernbedürftig, hab bisher auch wie brüggendiek das ganze mir array gemacht, aber wie funktioniert denn so eine "FindComponent" genau??
also vielleicht ein einfacher Beispiel-source mit erklärung, soweit das keine umstände macht!
danke schonmal

ciao haegar

Daniel B 1. Feb 2003 20:23

Du bist schon a bisserl Faul?! :twisted: :twisted:
1. Suche benutzen, dies wurde schon sehr oft besprochen.
2. Sagt die OH folgendes dazu:
Delphi-Quellcode:
Indicates whether a given component is owned by the component.

function FindComponent(const AName: string): TComponent;

Description

FindComponent returns the component in the Components property array with the name that matches the string in the AName parameter. Use FindComponent to determine whether a given component is owned by another.
Delphi-Quellcode:
The following example creates 20 edit boxes, using FindComponent with the edit box name to access each newly created edit box.

procedure TForm1.Button1Click(Sender: TObject);

var
  i: Integer;
const
  NamePrefix = 'MyEdit';
begin
  for i := 1 to 20 do begin
    TEdit.Create(Self).Name := NamePrefix + IntToStr(i);
    with TEdit(FindComponent(NamePrefix + IntToStr(i))) do
    begin
      Left := 10;
      Top := i * 20;
      Parent := self;
    end;
  end;
end;
Grüsse, Daniel :hi:

Haegar 1. Feb 2003 20:29

ja hast ja recht, sry, werd das nächste mal erst inne hilfe schauen ;)
trotzdem danke

Christian Seehase 1. Feb 2003 22:39

Moin Nailor,

Zitat:

...wird das nachher ein sehr schöner Spass, die Variabelnamen zu ändern!
könntest Du mir bitte mal auf die Sprünge helfen?
Das hab' ich nicht verstanden.

Daniel B 1. Feb 2003 22:47

Moin Christian,
Zitat:

Zitat von Christian Seehase
könntest Du mir bitte mal auf die Sprünge helfen?

Ich denke Er meint, das wenn man in einer Schleife, Komponenten erzeugt, dann haben die ja einen Index. Eins bis sowieso.
Wenn man nun die Namen ändert, so hat man natürlcih keine Chanche mehr mit FindComponent('Name' + IntToStr(i));

Ich denke das Er dies gemeint hat. So hab ich das verstanden.

Grüsse, Daniel :hi:


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:32 Uhr.
Seite 2 von 2     12   

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