<?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[Funktionen von dynamischen Objekten]]></title><description><![CDATA[<p>Hallo,<br />
vieleicht kann mir mal jemand helfen.<br />
Ich möchte mit dem OnClick Ereignis von dynamisch erzeugten Button´s eine Funktion aufrufen und dieser eien Wert(Schleifenzähler) übergeben. Aber das funkzt nicht.</p>
<pre><code class="language-cpp">[h][code]for(int a = 0; a &lt; 10; a++)
  {
   MyButton[a] = new TButton(this);
   MyButton[a]-&gt;OnClick = Funktionxyz([i]a[/i]); 
  } 

  void __fastcall TForm1::Funktionxyz(int [i]a[/i]) 
{ 
    ShowMessage(&quot;test &quot;+[i] a [/i]); 
}[/code][/h]
</code></pre>
<p>Kann mir da mal jemand helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/123270/funktionen-von-dynamischen-objekten</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 05:10:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/123270.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 14 Oct 2005 14:02:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Funktionen von dynamischen Objekten on Fri, 14 Oct 2005 14:02:56 GMT]]></title><description><![CDATA[<p>Hallo,<br />
vieleicht kann mir mal jemand helfen.<br />
Ich möchte mit dem OnClick Ereignis von dynamisch erzeugten Button´s eine Funktion aufrufen und dieser eien Wert(Schleifenzähler) übergeben. Aber das funkzt nicht.</p>
<pre><code class="language-cpp">[h][code]for(int a = 0; a &lt; 10; a++)
  {
   MyButton[a] = new TButton(this);
   MyButton[a]-&gt;OnClick = Funktionxyz([i]a[/i]); 
  } 

  void __fastcall TForm1::Funktionxyz(int [i]a[/i]) 
{ 
    ShowMessage(&quot;test &quot;+[i] a [/i]); 
}[/code][/h]
</code></pre>
<p>Kann mir da mal jemand helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892389</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892389</guid><dc:creator><![CDATA[Hugorantanplan]]></dc:creator><pubDate>Fri, 14 Oct 2005 14:02:56 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionen von dynamischen Objekten on Fri, 14 Oct 2005 14:08:28 GMT]]></title><description><![CDATA[<p>da solltest du mal unter TNotifyEvent OnClick in der Hilfe nachschauen, was für Parameter übegeben werden dürfen und was sie bedeuten sollen.</p>
<p>So wie du das willst ist das nicht möglich. Im OnClick wird der Sender übergeben und nix anderes.</p>
<p>Mache deine Laufvariabe zu einem Mitglied der Formklasse und OnClick kann darauf zugreifen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892393</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892393</guid><dc:creator><![CDATA[Christian211]]></dc:creator><pubDate>Fri, 14 Oct 2005 14:08:28 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionen von dynamischen Objekten on Fri, 14 Oct 2005 14:10:56 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>klar klappt das nicht, denn du kannst den Eventen nur Mehtoden mit festgelegten Signaturen übergeben. Dein Problem kann man durch die Eigenschaft Tag lösen</p>
<pre><code class="language-cpp">for(int a = 0; a &lt; 10; a++)
  {
   MyButton[a] = new TButton(this);
   MyButton[a]-&gt;OnClick = Funktionxyz;
   MyButton[a]-&gt;Tag = a;
  }

void __fastcall TForm1::Funktionxyz(TObject *Sender)
{
  TButton *CurButton = static_cast&lt;TButton *&gt; (Sender); // Sender als TButton behandeln
    ShowMessage(&quot;test &quot;+ IntToStr(CurButton-&gt;Tag) );
}
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892395</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892395</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Fri, 14 Oct 2005 14:10:56 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionen von dynamischen Objekten on Sat, 15 Oct 2005 15:52:24 GMT]]></title><description><![CDATA[<p>Vielen Dank, die Variante von akari funktioniert. Ihr habt mir sehr geholfen!! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/892925</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892925</guid><dc:creator><![CDATA[Hugorantanplan]]></dc:creator><pubDate>Sat, 15 Oct 2005 15:52:24 GMT</pubDate></item></channel></rss>