<?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[Weiteres Problem mit dynamic_cast]]></title><description><![CDATA[<p>Hallo,<br />
habe ein Problem.</p>
<pre><code class="language-cpp">TComponent *comp = pForm-&gt;Components[i];
...
else if (pForm-&gt;Components[i]-&gt;ClassNameIs(&quot;TStringGrid&quot;))
            {
                 TStringGrid * pStringGridGrid = dynamic_cast&lt;TStringGrid *&gt;(comp);

                 ...
            }
</code></pre>
<p>Bekomme dabei eine Fehlermeldung. TStringGrid sei ein undefiniertes Symbol.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/164208/weiteres-problem-mit-dynamic_cast</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 07:39:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/164208.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 Nov 2006 08:13:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Weiteres Problem mit dynamic_cast on Mon, 06 Nov 2006 08:13:03 GMT]]></title><description><![CDATA[<p>Hallo,<br />
habe ein Problem.</p>
<pre><code class="language-cpp">TComponent *comp = pForm-&gt;Components[i];
...
else if (pForm-&gt;Components[i]-&gt;ClassNameIs(&quot;TStringGrid&quot;))
            {
                 TStringGrid * pStringGridGrid = dynamic_cast&lt;TStringGrid *&gt;(comp);

                 ...
            }
</code></pre>
<p>Bekomme dabei eine Fehlermeldung. TStringGrid sei ein undefiniertes Symbol.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1169380</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1169380</guid><dc:creator><![CDATA[radian]]></dc:creator><pubDate>Mon, 06 Nov 2006 08:13:03 GMT</pubDate></item><item><title><![CDATA[Reply to Weiteres Problem mit dynamic_cast on Mon, 06 Nov 2006 08:33:39 GMT]]></title><description><![CDATA[<p>Schau mal in der Doku nach, ob du eventuell den richtigen Header vergessen hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1169396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1169396</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Mon, 06 Nov 2006 08:33:39 GMT</pubDate></item><item><title><![CDATA[Reply to Weiteres Problem mit dynamic_cast on Mon, 06 Nov 2006 09:06:50 GMT]]></title><description><![CDATA[<p>also das funktioniert bei mir (nix spezielles includes o.ä)</p>
<pre><code class="language-cpp">for(int i = 0; i&lt; Form1-&gt;ComponentCount; ++i)
   {
    if(Form1-&gt;Components[i]-&gt;ClassNameIs(&quot;TLabel&quot;))
       {
        dynamic_cast&lt;TLabel*&gt;(Form1-&gt;Components[i])-&gt;Caption=&quot;A Label&quot;;
       }
    if(Form1-&gt;Components[i]-&gt;ClassNameIs(&quot;TButton&quot;))
       {
        dynamic_cast&lt;TButton*&gt;(Form1-&gt;Components[i])-&gt;Caption=&quot;A Button&quot;;
        if(dynamic_cast&lt;TButton*&gt;(Form1-&gt;Components[i])-&gt;Name==&quot;Button1&quot;)
           {
            dynamic_cast&lt;TButton*&gt;(Form1-&gt;Components[i])-&gt;Caption=&quot;Special Button&quot;;
           }  
       }
    if(Form1-&gt;Components[i]-&gt;ClassNameIs(&quot;TStringGrid&quot;))
       {
        dynamic_cast&lt;TStringGrid*&gt;(Form1-&gt;Components[i])-&gt;Cells[1][1]=&quot;TEST&quot;;
       }
   }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1169415</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1169415</guid><dc:creator><![CDATA[ser1al]]></dc:creator><pubDate>Mon, 06 Nov 2006 09:06:50 GMT</pubDate></item><item><title><![CDATA[Reply to Weiteres Problem mit dynamic_cast on Mon, 06 Nov 2006 09:39:23 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Der Header für TStringGrid heißt übrigend grids.hpp</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7454">@ser1al</a><br />
Wenn du schon dynamic_cast verwendest, solltest du seine Eigenschaften auch nutzen. Wenn du sicher bist welche Klasse hinter der Komponente steckt reicht nämlich auch ein static_cast. Ansonsten gefällt mir das hier besser (ist auch schneller <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> )</p>
<pre><code class="language-cpp">for(int i = 0; i&lt; Form1-&gt;ComponentCount; ++i)
   {
    TLabel* label = dynamic_cast&lt;TLabel*&gt;(Form1-&gt;Components[i]);
    if(label)
       {
        label-&gt;Caption=&quot;A Label&quot;;
       }
    TButton* button = dynamic_cast&lt;TButton*&gt;(Form1-&gt;Components[i]);
    if(button)
       {
        button-&gt;Caption=&quot;A Button&quot;;
        if(button-&gt;Name==&quot;Button1&quot;)
           {
            button-&gt;Caption=&quot;Special Button&quot;;
           }  
       }
    TStringGrid* grid = dynamic_cast&lt;TStringGrid*&gt;(Form1-&gt;Components[i]);
    if(grid)
       {
        grid-&gt;Cells[1][1]=&quot;TEST&quot;;
       }
   }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1169435</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1169435</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Mon, 06 Nov 2006 09:39:23 GMT</pubDate></item><item><title><![CDATA[Reply to Weiteres Problem mit dynamic_cast on Mon, 06 Nov 2006 10:43:11 GMT]]></title><description><![CDATA[<p>Braunstein schrieb:</p>
<blockquote>
<p>Hallo,<br />
<a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7454">@ser1al</a><br />
Wenn du schon dynamic_cast verwendest, solltest du seine Eigenschaften auch nutzen. Wenn du sicher bist welche Klasse hinter der Komponente steckt reicht nämlich auch ein static_cast.</p>
</blockquote>
<p>du hast natürlich recht, wollte es ja nur schnell zeigen, ohne auf sinn und unsinn einzugehen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1169483</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1169483</guid><dc:creator><![CDATA[ser1al]]></dc:creator><pubDate>Mon, 06 Nov 2006 10:43:11 GMT</pubDate></item><item><title><![CDATA[Reply to Weiteres Problem mit dynamic_cast on Mon, 06 Nov 2006 13:47:50 GMT]]></title><description><![CDATA[<p>Danke für eure Tips. Habe es hinbekommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1169651</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1169651</guid><dc:creator><![CDATA[radian]]></dc:creator><pubDate>Mon, 06 Nov 2006 13:47:50 GMT</pubDate></item></channel></rss>