<?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[Komponente zur laufzeit erzeugen]]></title><description><![CDATA[<p>ich erzeuge durch</p>
<pre><code class="language-cpp">TCheckBox *cbAgregate[30];
</code></pre>
<p>ein Komponenten arry in der .h datei<br />
in der cpp</p>
<pre><code class="language-cpp">AnzahlAgregate = AgregateListe-&gt;Count;

   for (int x = 0; x&lt;AnzahlAgregate; x++)
   {
      cbAgregate[x] = new TCheckBox(this);
      cbAgregate[x]-&gt;Parent = Form1;
      cbAgregate[x]-&gt;Left = 24;
      cbAgregate[x]-&gt;Top = 100+x*16;
      cbAgregate[x]-&gt;Caption = AgregateListe-&gt;Strings[x];
      cbAgregate[x]-&gt;Checked = iniMaschinenDaten-&gt;ReadBool(comboMaschinen-&gt;Items-&gt;Strings[cbMaschinen-&gt;ItemIndex],
                                                            cbAgregate[x]-&gt;Caption,
                                                            false);
   }
</code></pre>
<p>und</p>
<pre><code class="language-cpp">void __fastcall TForm1::FormDestroy(TObject *Sender)
{
   for (int x = 0; x&lt;AnzahlAgregate; x++)
   {
      delete cbAgregate[x];
   }
}

//----
   TStringList *AgregateListe = new TStringList;
</code></pre>
<p>und jetzt zu meiner frage:<br />
mit TCheckBox *cbAgregate[30]; reserviere ich ja speicher für 30 CheckBoxe.<br />
kann ich nicht zuerst die TStringList über -&gt; Count Abfragen und dan entsprechend Speicher reservieren?<br />
zB:</p>
<pre><code class="language-cpp">AnzahlAgregate = AgregateListe-&gt;Count;
TCheckBox *cbAgregate[AnzahlAgregate];
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/98158/komponente-zur-laufzeit-erzeugen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Jul 2026 23:26:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/98158.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 Jan 2005 09:27:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Komponente zur laufzeit erzeugen on Mon, 17 Jan 2005 09:27:27 GMT]]></title><description><![CDATA[<p>ich erzeuge durch</p>
<pre><code class="language-cpp">TCheckBox *cbAgregate[30];
</code></pre>
<p>ein Komponenten arry in der .h datei<br />
in der cpp</p>
<pre><code class="language-cpp">AnzahlAgregate = AgregateListe-&gt;Count;

   for (int x = 0; x&lt;AnzahlAgregate; x++)
   {
      cbAgregate[x] = new TCheckBox(this);
      cbAgregate[x]-&gt;Parent = Form1;
      cbAgregate[x]-&gt;Left = 24;
      cbAgregate[x]-&gt;Top = 100+x*16;
      cbAgregate[x]-&gt;Caption = AgregateListe-&gt;Strings[x];
      cbAgregate[x]-&gt;Checked = iniMaschinenDaten-&gt;ReadBool(comboMaschinen-&gt;Items-&gt;Strings[cbMaschinen-&gt;ItemIndex],
                                                            cbAgregate[x]-&gt;Caption,
                                                            false);
   }
</code></pre>
<p>und</p>
<pre><code class="language-cpp">void __fastcall TForm1::FormDestroy(TObject *Sender)
{
   for (int x = 0; x&lt;AnzahlAgregate; x++)
   {
      delete cbAgregate[x];
   }
}

//----
   TStringList *AgregateListe = new TStringList;
</code></pre>
<p>und jetzt zu meiner frage:<br />
mit TCheckBox *cbAgregate[30]; reserviere ich ja speicher für 30 CheckBoxe.<br />
kann ich nicht zuerst die TStringList über -&gt; Count Abfragen und dan entsprechend Speicher reservieren?<br />
zB:</p>
<pre><code class="language-cpp">AnzahlAgregate = AgregateListe-&gt;Count;
TCheckBox *cbAgregate[AnzahlAgregate];
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/698510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/698510</guid><dc:creator><![CDATA[BigNeal]]></dc:creator><pubDate>Mon, 17 Jan 2005 09:27:27 GMT</pubDate></item><item><title><![CDATA[Reply to Komponente zur laufzeit erzeugen on Mon, 17 Jan 2005 09:35:42 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>dazu brauchst du entweder DynamicArray (die einfache VCL-Variante) oder std::vector (die Standart-C++ Variant).<br />
Beides sollte im Forum und BCB-Hilfe ausreichend erklärt sein.</p>
<p>/Edit : Da hab ich wohl Standard falsch geschrieben... peinlich</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/698518</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/698518</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 17 Jan 2005 09:35:42 GMT</pubDate></item><item><title><![CDATA[Reply to Komponente zur laufzeit erzeugen on Mon, 17 Jan 2005 13:04:18 GMT]]></title><description><![CDATA[<p>danke für die antwort.. ich werde mich da mal weiter informieren..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/698768</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/698768</guid><dc:creator><![CDATA[BigNeal]]></dc:creator><pubDate>Mon, 17 Jan 2005 13:04:18 GMT</pubDate></item><item><title><![CDATA[Reply to Komponente zur laufzeit erzeugen on Mon, 17 Jan 2005 21:23:15 GMT]]></title><description><![CDATA[<p>Siehe <a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39305" rel="nofollow">FAQ</a>, &quot;Komponenten benutzen - dynamische Arrays&quot;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/698952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/698952</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Mon, 17 Jan 2005 21:23:15 GMT</pubDate></item></channel></rss>