<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Dynamisch erstellte Komponente ansprechen]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>Ich habe ein Programm geschrieben, mit welchem ich beliebig viele TLabel's dynamisch erstelle.</p>
<pre><code>TLabel * newLabel3 = new TLabel(OR);
newLabel3-&gt;Caption = &quot;Out&quot;;
newLabel3-&gt;Name = &quot;OR_Out_&quot; + IntToStr(ORCounter+1);
newLabel3-&gt;Font-&gt;Name = &quot;Courier New&quot;;
newLabel3-&gt;Parent = this;
</code></pre>
<p>Jetzt möchte ich wenn ich z.B. ein Button klicke, dass die Namen von diesen TLabel's in einem RichEdit erscheinen!</p>
<p>Meine Frage ist wie kann ich die ganzen TLabel's ansprechen und deren Name in RichEdit schreiben?</p>
<pre><code>swlForm-&gt;swlRichEdit-&gt;Lines-&gt;Add(&quot;//Label &quot; + ???????-&gt;Name);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/205598/dynamisch-erstellte-komponente-ansprechen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 19 Aug 2026 22:00:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/205598.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 15 Feb 2008 19:53:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Fri, 15 Feb 2008 19:54:12 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>Ich habe ein Programm geschrieben, mit welchem ich beliebig viele TLabel's dynamisch erstelle.</p>
<pre><code>TLabel * newLabel3 = new TLabel(OR);
newLabel3-&gt;Caption = &quot;Out&quot;;
newLabel3-&gt;Name = &quot;OR_Out_&quot; + IntToStr(ORCounter+1);
newLabel3-&gt;Font-&gt;Name = &quot;Courier New&quot;;
newLabel3-&gt;Parent = this;
</code></pre>
<p>Jetzt möchte ich wenn ich z.B. ein Button klicke, dass die Namen von diesen TLabel's in einem RichEdit erscheinen!</p>
<p>Meine Frage ist wie kann ich die ganzen TLabel's ansprechen und deren Name in RichEdit schreiben?</p>
<pre><code>swlForm-&gt;swlRichEdit-&gt;Lines-&gt;Add(&quot;//Label &quot; + ???????-&gt;Name);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1456794</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1456794</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Fri, 15 Feb 2008 19:54:12 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Fri, 15 Feb 2008 21:19:44 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Siehe FAQ, Abschnitt Komponenten benutzen. Dort gibt es zum Beispiel einen Thread über dynamische Arrays von Controls.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1456885</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1456885</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Fri, 15 Feb 2008 21:19:44 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 09:30:48 GMT]]></title><description><![CDATA[<p>Ok das hat geklappt!<br />
Ich hoffe ich darf kurz das Thema erweitern. Ich habe jetzt ein anderes Problem.<br />
Wie gesagt ich erstelle dynamisch die Komponenten folgender Maße.</p>
<pre><code class="language-cpp">TImage *And = new TImage(this);
And-&gt;Parent = this;

And-&gt;Transparent = true;
And-&gt;Height = 50;
And-&gt;Width = 97;
And-&gt;Name = &quot;AND_&quot; + IntToStr(AndCounter+1);
And-&gt;OnMouseDown = StartPos;
And-&gt;OnMouseMove = MoveElement;

//Graphik
And-&gt;Canvas-&gt;Pen-&gt;Color = clBlack;
And-&gt;Canvas-&gt;Brush-&gt;Color = clWhite;
And-&gt;Canvas-&gt;Rectangle(X, Y, X + 50, Y + 50);

//Eigenschaften
TLabel * newLabel1 = new TLabel(And);
newLabel1-&gt;Left = X - 30;
newLabel1-&gt;Top = Y - 10;
newLabel1-&gt;Caption = &quot;In1&quot;;
newLabel1-&gt;Name = &quot;AND_In1_&quot; + IntToStr(AndCounter+1);
newLabel1-&gt;Font-&gt;Name = &quot;Courier New&quot;;
newLabel1-&gt;Parent = this;
newLabel1-&gt;Transparent = true;
newLabel1-&gt;OnDblClick = ElementPropertyIn
</code></pre>
<p>;</p>
<p>Wie man sieht ist in dieser &quot;And&quot; Komponente gibt es auch andere Komponente &quot;newLabel1&quot;. Folgender Maße spreche ich die Komponente &quot;And&quot; an!</p>
<pre><code>void __fastcall TForm1::Button1Click(TObject *Sender) 
{ 
    for(int i=0; i &lt; Form1-&gt;ComponentCount; i++) 
    { 
        // Alle Labels verändern 
        if (Form1-&gt;Components[i]-&gt;ClassNameIs(&quot;TLabel&quot;)) 
        { 
            dynamic_cast&lt;TLabel*&gt;(Form1-&gt;Components[i])-&gt;Caption = &quot;Alle Labels auf gleichen Wert setzen&quot;; 
        } 

        // oder eine spezielle Behandlung 
        if (Form1-&gt;Components[i]-&gt;ClassNameIs(&quot;TLabel&quot;)) 
        { 
            if (dynamic_cast&lt;TLabel*&gt;(Form1-&gt;Components[i])-&gt;Name == &quot;Label1&quot;) 
                dynamic_cast&lt;TLabel*&gt;(Form1-&gt;Components[i])-&gt;Caption = &quot;Ausnahme Label1&quot;; 
        } 

    } 
}
</code></pre>
<p>Aber wie spreche ich meine Komponnete &quot;newLabel1&quot;,welche sich in der Komponente &quot;And&quot; befgindet. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457012</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Sat, 16 Feb 2008 09:30:48 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 09:36:54 GMT]]></title><description><![CDATA[<p>newLabel1 befindet sich nicht in einer anderen Komponente.<br />
And ist ein TImage und newLabel1 ist ein TLabel.Das Prinzip bleibt gleich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457015</guid><dc:creator><![CDATA[knl]]></dc:creator><pubDate>Sat, 16 Feb 2008 09:36:54 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 09:38:53 GMT]]></title><description><![CDATA[<p>Das Problem ist, das sobald du den Scope verlässt And und newLabel nicht mehr existieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457016</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457016</guid><dc:creator><![CDATA[knl]]></dc:creator><pubDate>Sat, 16 Feb 2008 09:38:53 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 10:11:09 GMT]]></title><description><![CDATA[<p>Hallo,<br />
das stimmt aber nicht!<br />
da wenn ich folgends mache, kriege ich alle Komponent aufgezählt, welche bei mir auf meiner Form sind.</p>
<pre><code class="language-cpp">this-&gt;Label1-&gt;Caption = IntToStr(this-&gt;ComponentCount);
</code></pre>
<p>Ohne dynamisch erstellte Komponente &quot;And&quot; kriege ich eine Zahl von 4, da ich auf meiner Form 2 Buttons und 2 Labels fest sitzen habe.<br />
Wenn ich eine dynamische Komponente erstelle un die obige funktion aufrufe dann bekomme ich 5 Komponete als ComponentCount.</p>
<p>Laut deiner Aussage knl muss ich aber 6 Komponente als Zahl für ComponentCount bekommen, da ich bei dynamischer Erstellung ein TImage und TLabel erstelle.<br />
Ich habe zuerst auch so gedacht, dann habe ich aber die obige Funktion ausprobiert.</p>
<p>Falls ich dich falsch verstanden habe, dann sorry! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>So sieht mein Code momentan mit dem ich diese Komponente anspreche aus!</p>
<pre><code class="language-cpp">void __fastcall TLogicWin::Button2Click(TObject *Sender)
{
	for (int ANDtranslate = 0; ANDtranslate &lt; this-&gt;ComponentCount; ANDtranslate++)
	{
		for (int iAndCounter = 1; iAndCounter &lt;= AndCounter; iAndCounter++)
		{
			if (this-&gt;Components[ANDtranslate]-&gt;Name == &quot;AND_&quot; + IntToStr(iAndCounter))
				{
				 swlForm-&gt;swlRichEdit-&gt;Lines-&gt;Add(&quot;//Component &quot; + this-&gt;Components[ANDtranslate]-&gt;Name);
				 swlForm-&gt;swlRichEdit-&gt;Lines-&gt;Add(&quot;    U &quot; + this-&gt;Components[ANDtranslate+1]-&gt;Name + &quot;;&quot; );
				 }
		}

	}
	this-&gt;Label1-&gt;Caption = IntToStr(this-&gt;ComponentCount);
	swlForm-&gt;Show();

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1457036</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457036</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Sat, 16 Feb 2008 10:11:09 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 10:26:59 GMT]]></title><description><![CDATA[<p>Sorry das ich hier grad meine Frage einfach so rein schmeiße, aber ich hantiere gerade auch mit dynamische erstellten Objekten herum.</p>
<p>Meine Frage: Kann ich Objekte auch vollständig dynamisch erstellen ?<br />
Heißt: Den Namen für das Objekt muss ich immer selber vorgeben ..</p>
<p>Ist das so okay ?</p>
<pre><code>for(int i=0; i &lt; this-&gt;ComponentCount; i++){
      TImage *NewOb = new TImage(this);
      NewOb-&gt;Parent = this;
      NewOb-&gt;Name = (&quot;IMG_Prog&quot; + String(i));
      }
</code></pre>
<p>Gruß Pixtar</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457043</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457043</guid><dc:creator><![CDATA[Pixtar]]></dc:creator><pubDate>Sat, 16 Feb 2008 10:26:59 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 10:42:38 GMT]]></title><description><![CDATA[<p>swunder schrieb:</p>
<blockquote>
<p>Aber wie spreche ich meine Komponnete &quot;newLabel1&quot;,welche sich in der Komponente &quot;And&quot; befgindet. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
</blockquote>
<p>Wie schon gesagt, dein newLabel1 befindet sich nicht <strong>in</strong> dem TImage And, sondern liegt sozusagen oben drauf. Es ist aber weiter ein eigenständiges Objekt und wird ganz normal angesprochen:</p>
<pre><code class="language-cpp">newLabel1-&gt;Caption = &quot;blabla&quot;;
</code></pre>
<p>Pixtar schrieb:</p>
<blockquote>
<pre><code>for(int i=0; i &lt; this-&gt;ComponentCount; i++){
      TImage *NewOb = new TImage(this);
      NewOb-&gt;Parent = this;
      NewOb-&gt;Name = (&quot;IMG_Prog&quot; + String(i));
      }
</code></pre>
<p>Ist das so okay ?</p>
</blockquote>
<p>Nein. Die <em>Name</em>-Eigenschaft einer Komponente ist nur ein Anzeigename. Der echte Name aller deiner TImage-Instanzen wäre <em>New0b</em>, und das gibt Chaos.<br />
Du brauchst die oben erwähnten Arrays.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457048</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457048</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Sat, 16 Feb 2008 10:42:38 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 11:04:25 GMT]]></title><description><![CDATA[<p>Jansen schrieb:</p>
<pre><code>Wie schon gesagt, dein newLabel1 befindet sich nicht in dem TImage And, sondern liegt sozusagen oben drauf. Es ist aber weiter ein eigenständiges Objekt und wird ganz normal angesprochen:
</code></pre>
<p>Gut das habe ich schon verstanden!! Aber wie spreche ich dieses TLAbel &quot;newLabel1&quot;, welches auf dem TImage &quot;And&quot; liegt an, wenn es gar nicht in &quot;ComponentCount&quot; aufgezählt wird??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457058</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457058</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Sat, 16 Feb 2008 11:04:25 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 11:33:01 GMT]]></title><description><![CDATA[<p>@ swunder: Ich glaube du meinst -&gt; Das deine for-Schleife dann nicht alle Elemente ansprechen kann.</p>
<p>Ich habs grad mal getestet, funktionieren tuts bei mir wenn ich den Code verwende:</p>
<pre><code>this-&gt;Label1-&gt;Caption = this-&gt;ComponentCount+(And-&gt;ComponentCount);
</code></pre>
<p>@ Jansen: Welche erwähnten Arrays meinst du denn?<br />
Ich sehe hier im Thread nur ein Array und das ist This-&gt;Components[i]; ?!</p>
<p>Gruß Pixtar</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457063</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457063</guid><dc:creator><![CDATA[Pixtar]]></dc:creator><pubDate>Sat, 16 Feb 2008 11:33:01 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 11:51:48 GMT]]></title><description><![CDATA[<p>Pixtar,</p>
<p>vielleicht blöde Frage aber was ist bei dir &quot;And&quot;?? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /><br />
Es is ja unmöglich die dynamisch erstellte Komponnete &quot;And&quot; direkt zu adressieren oder? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /><br />
Kannst du mir den Code geben, der bei dir funktioniert hat?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457065</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457065</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Sat, 16 Feb 2008 11:51:48 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 12:00:36 GMT]]></title><description><![CDATA[<p>Na ich hab grad nichts anderes gemacht als deinen Code genommen:</p>
<pre><code>TImage *And = new TImage(this);
And-&gt;Parent = this;

And-&gt;Transparent = true;
And-&gt;Height = 50;
And-&gt;Width = 97;
And-&gt;Name = &quot;AND_&quot; + IntToStr(AndCounter+1);
And-&gt;OnMouseDown = StartPos;
And-&gt;OnMouseMove = MoveElement;

//Graphik
And-&gt;Canvas-&gt;Pen-&gt;Color = clBlack;
And-&gt;Canvas-&gt;Brush-&gt;Color = clWhite;
And-&gt;Canvas-&gt;Rectangle(X, Y, X + 50, Y + 50);

//Eigenschaften
TLabel * newLabel1 = new TLabel(And);
newLabel1-&gt;Left = X - 30;
newLabel1-&gt;Top = Y - 10;
newLabel1-&gt;Caption = &quot;In1&quot;;
newLabel1-&gt;Name = &quot;AND_In1_&quot; + IntToStr(AndCounter+1);
newLabel1-&gt;Font-&gt;Name = &quot;Courier New&quot;;
newLabel1-&gt;Parent = this;
newLabel1-&gt;Transparent = true;
newLabel1-&gt;OnDblClick = ElementPropertyIn
</code></pre>
<p>Hab nen paar Variablen die ich nicht hatte durch Werte ersetzt</p>
<p>Und dann habe ich deinen Code</p>
<pre><code>this-&gt;Label1-&gt;Caption = IntToStr(this-&gt;ComponentCount);
</code></pre>
<p>einfach angepasst an das bereits gepostete</p>
<pre><code>this-&gt;Label1-&gt;Caption = this-&gt;ComponentCount+(And-&gt;ComponentCount);
</code></pre>
<p>Naja im ersten Code erstellst du ein Objekt Namens And vom Typ TImage. Dann erstellst du nen Objekt Namens newLabel1 vom Typ Label das aber auf deinem Objekt And liegt.<br />
Die Objekte auf der Form zählst du + die Objekte auf deinem And-Objekt.</p>
<p>Weiter ging mein Gedanke nicht, ich weiß nicht mals ob jetzt gleich nicht irgendein Freak vorbei kommt und sagt: DAS DARF MAN GARNICHT MACHEN oder WAS DU GESAGT HAST IST BULLSHIT .... naja es funzt aber <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Hoffentlich wars verständlich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Gruß Pixtar</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457066</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457066</guid><dc:creator><![CDATA[Pixtar]]></dc:creator><pubDate>Sat, 16 Feb 2008 12:00:36 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 12:04:32 GMT]]></title><description><![CDATA[<p>hahahahahahah!</p>
<p>Beim Compelieren schreibt kriege ich einen Fehler!</p>
<pre><code>Undefined Symbol And
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Das ist doch ein scherz oder??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457067</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457067</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Sat, 16 Feb 2008 12:04:32 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 12:09:25 GMT]]></title><description><![CDATA[<p>ach so!</p>
<p>das hat deswegen funktioniert, weil du alles in einer Schleife machst.</p>
<p>ich muss es in einer anderen Schleife machen!!</p>
<p>sprich</p>
<p>void __fastcall TLogicWin::ElementAND (int X, int Y)<br />
{<br />
// komponnete erstellen<br />
}<br />
void __fastcall TLogicWin::schreibe (int X, int Y)<br />
{<br />
// dynamische komponente ansprechen<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457069</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457069</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Sat, 16 Feb 2008 12:09:25 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 12:40:43 GMT]]></title><description><![CDATA[<p>Ich glaub zu dem Code muss ich nicht mehr viel sagen oder ?</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
int GetCount(TForm1 *FormPtr, TImage *ImgPtr);
void CreateObj(TForm1 *FormPtr);
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
   CreateObj(this);
}

//---------------------------------------------------------------------------
int GetCount(TForm1 *FormPtr, TImage *ImgPtr){
    int Counted = FormPtr-&gt;ComponentCount+(ImgPtr-&gt;ComponentCount);
    return Counted;
}
//---------------------------------------------------------------------------
void CreateObj(TForm1 *FormPtr){
    TImage *And = new TImage(FormPtr);
    And-&gt;Parent = FormPtr;

    And-&gt;Transparent = FormPtr;
    And-&gt;Height = 50;
    And-&gt;Width = 97;
    And-&gt;Name = &quot;AND_1&quot;;

    //Graphik
    And-&gt;Canvas-&gt;Pen-&gt;Color = clBlack;
    And-&gt;Canvas-&gt;Brush-&gt;Color = clWhite;
    And-&gt;Canvas-&gt;Rectangle(20, 20, 20 + 50, 20 + 50);

    //Eigenschaften
    TLabel * newLabel1 = new TLabel(And);
    newLabel1-&gt;Left = 20 - 30;
    newLabel1-&gt;Top = 20 - 10;
    newLabel1-&gt;Caption = &quot;In1&quot;;
    newLabel1-&gt;Name = &quot;AND_In1_1&quot;;
    newLabel1-&gt;Font-&gt;Name = &quot;Courier New&quot;;
    newLabel1-&gt;Parent = FormPtr;
    newLabel1-&gt;Transparent = true;

    //Eigenschaften
    TLabel * newLabel2 = new TLabel(And);
    newLabel2-&gt;Left = 20 - 30;
    newLabel2-&gt;Top = 20 - 10;
    newLabel2-&gt;Caption = &quot;In1&quot;;
    newLabel2-&gt;Name = &quot;AND_In1_2&quot;;
    newLabel2-&gt;Font-&gt;Name = &quot;Courier New&quot;;
    newLabel2-&gt;Parent = FormPtr;
    newLabel2-&gt;Transparent = FormPtr;
    FormPtr-&gt;Label1-&gt;Caption = IntToStr(GetCount(Form1,And));
}
</code></pre>
<p><strong>Ich hoffe damit kommst du der Lösung deines Problems näher !</strong></p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> Greez Pixtar</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457083</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457083</guid><dc:creator><![CDATA[Pixtar]]></dc:creator><pubDate>Sat, 16 Feb 2008 12:40:43 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 13:24:20 GMT]]></title><description><![CDATA[<p>ich scahaue den den Code später an! Frau ruft!! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Falls was melde ich mich später!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457095</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Sat, 16 Feb 2008 13:24:20 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sat, 16 Feb 2008 19:58:24 GMT]]></title><description><![CDATA[<p>Pixtar:<br />
Ich meine den von akari angesprochenen FAQ-Eintrag zu dynamischen Arrays.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457245</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457245</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Sat, 16 Feb 2008 19:58:24 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sun, 17 Feb 2008 08:45:18 GMT]]></title><description><![CDATA[<p>Hi Pixtar,</p>
<p>Also wie gesagt dein Code funktioniert nicht so wie ich es brauche. Bei dir geschieht alles während deine Komponente erstellt wird. Beim Erstellen wird bei dir eine Funktion aufgerufen, die die Komponente zählt.</p>
<p>Bloß es ist nicht das was ich brauche.</p>
<p>Da ich erst einmal sagen wir mal 5 &quot;And&quot; Komponente erstelle und dann einen Knopf drücke, der mir alle Komponente, auch die TLabels die auf &quot;And&quot; liegen, in mein RichEdit bzw. Memo reinschreiben soll.</p>
<p>Kann mir da vielleicht jemand helfen??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457371</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457371</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Sun, 17 Feb 2008 08:45:18 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Sun, 17 Feb 2008 11:00:03 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Irgendwie verstehe ich dein Problem nicht. Insbesondere sehe ich keinen Sinn die Labels mit Owner = Image und Parent = Form zu erstellen. Was erhoffst du dir davon?</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457440</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457440</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 17 Feb 2008 11:00:03 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Mon, 18 Feb 2008 08:25:24 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7971">@akari</a><br />
stell dir mal ein AND-Glied vor. Er hat 2 Eingänge und 1 Ausgang. Durch die diese TLabels werden die Eingänge und Ausgang benannt. Das AND-Glied muss auf der Form verschiebbar sein und TLabels (Caption) müssen veränderbar sein.<br />
Dafür muss ich diese TLabels ansprechen können, um die Tlabels zu ändern.</p>
<p>Mir ist keine andere Lösung eingefallen, daher habe ich das so gemacht.</p>
<p>Ich weis wie ich diese TLabels (Caption) verändern kann, wenn ich auf diese Tlabels oder TImage drücke, was auch funktioniert.<br />
Im nächsten Schritt muss ich alle TLabels, die sich bei mir auf dem TImage befinden, ansprechen und in TRichEdit bzw TMemo auflisten.</p>
<p>Natürlich gibt es eine andere Möglichkeit die Tlabels in TRichEdit bzw. TMemo reinzuschreiben. Z.B. bei der Erstellung dieser TLabels. Bloß mein Prof. verlangt, das ich diese so anspreche, wie oben es beschrieben ist.</p>
<p>Gruß<br />
swunder</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457988</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457988</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Mon, 18 Feb 2008 08:25:24 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Mon, 18 Feb 2008 08:43:43 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Das ist ja schön und gut, aber trotzdem ergibt die besagte Belegung von Owner und Parent keinen Sinn. Also zitier ich doch die BCB-Hilfe :<br />
- Owner gibt an welcher Container für die Speicherverwaltung der Komponente zuständig ist. Dabei wird das Control in das Array <em>Components</em> des Owners eingetragen und ist darüber iterierbar.<br />
- Parent gibt an in welchem Container das Control angezeigt werden soll.</p>
<p>Wenn du also sowohl Owner als auch Parent der Labels auf das Image setzt, kannst du alle Labels (und nur diese Labels) über Components des Images iterieren.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1457993</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1457993</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 18 Feb 2008 08:43:43 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Mon, 18 Feb 2008 12:21:54 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7971">@akari</a><br />
Also irgendwie komme ich nicht ganz dahinter, was du mir damit sagen möchtest!<br />
Wie würdest du den mein Problem Lösen bzw. die Komponente mit TLabels erstellen?</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1458140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458140</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Mon, 18 Feb 2008 12:21:54 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Mon, 18 Feb 2008 12:34:53 GMT]]></title><description><![CDATA[<p>Meinst du das ich die Komponente so erstellen soll!</p>
<pre><code class="language-cpp">const int x = 10; 
TImage *img[x]; 

for (int i = 0; i &lt; x; i++) 
{ 
  img[i] = new TImage(this); 
  img[i]-&gt;Parent = this; 
  img[i]-&gt;Width = 32; 
  img[i]-&gt;Height = 32; 
  img[i]-&gt;Top = i * 35; 

   TLabel * newLabel1 = new TLabel(And);
   newLabel1-&gt;Left = 20 - 30;
   newLabel1-&gt;Top = 20 - 10;
   newLabel1-&gt;Caption = &quot;In1&quot;;
   newLabel1-&gt;Name = &quot;AND_In1_1&quot;;
   newLabel1-&gt;Font-&gt;Name = &quot;Courier New&quot;;
   newLabel1-&gt;Parent = FormPtr;
   newLabel1-&gt;Transparent = true;

}
</code></pre>
<p>und dann so ansprechen soll!</p>
<pre><code class="language-cpp">for (int ii = 0; ii &lt; x; ii++) 
{ 
Form2-&gt;RichEdit1-&gt;Lines-&gt;Add[Form1-&gt;img[ii]-&gt;newLabel1-&gt;Name];
}
</code></pre>
<p>Wird es gehen? Kann leider nicht ausprobieren, da ich auf der Arbeit bin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1458145</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458145</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Mon, 18 Feb 2008 12:34:53 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Mon, 18 Feb 2008 15:01:50 GMT]]></title><description><![CDATA[<p>Unqualifizierte Zwischenfrage: Wird das eine Diplomarbeit? AND-Glieder benennen, verschieben, auflisten... liest sich wie ein kleiner, selbstgeschriebener Editor für einfache Digitalschaltungen... das interessiert mich! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1458242</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458242</guid><dc:creator><![CDATA[Kolumbus]]></dc:creator><pubDate>Mon, 18 Feb 2008 15:01:50 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Mon, 18 Feb 2008 15:58:01 GMT]]></title><description><![CDATA[<p>Das ist keine Diplomarbeit.<br />
Einfach Freizeit Projekt, damit erlerne ich Builder C++.<br />
Aber alles andere stimmt.<br />
Bin so gesehen fast fertig! Fehlt bloß diese blöde Geschichte und paar Feineinstellungen?</p>
<p>Help!!!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1458281</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458281</guid><dc:creator><![CDATA[swunder]]></dc:creator><pubDate>Mon, 18 Feb 2008 15:58:01 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamisch erstellte Komponente ansprechen on Tue, 19 Feb 2008 08:34:25 GMT]]></title><description><![CDATA[<p>Coole Idee! Darf man das dann evtl mal testen wenns fertig ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1458609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1458609</guid><dc:creator><![CDATA[Kolumbus]]></dc:creator><pubDate>Tue, 19 Feb 2008 08:34:25 GMT</pubDate></item></channel></rss>