<?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[Komponenten (Images) während der Laufzeit erzeugen und Event (OnClick) zuweisen]]></title><description><![CDATA[<p>Hallo alle zusammen...</p>
<p>Ich hab 12 Images dynamisch mit Hilfe eines Arrays erzeugt und hab allen 12 Image ein und das selbe Bild (durch loadfromfile) zugewiesen. Jetzt möchte ich, dass wenn ich ein Bild anklicke ein anderes Bild (aber je nach Position im Array ein anderes) geladen/angezeigt wird. Ich programmiere mit dem C++ Builder 6.</p>
<p>Mein code zum erzeugen und Bild laden sieht wie folgt aus:</p>
<pre><code class="language-cpp">void __fastcall TForm1::Button1Click(TObject *Sender)
{
int j = 0;
int x = 0;
for (int i = 1; i &lt;13; i++)
   {
   if (x == 4) x = 0;
   Karte[i].Bild = new TImage(this);
   Karte[i].Bild-&gt;Picture-&gt;LoadFromFile(&quot;karte.bmp&quot;);
   Karte[i].Bild-&gt;SetBounds(10+134*x,10+134*j,124,124);
   Karte[i].Bild-&gt;Parent = this;
   x++;
   if (i % 4 == 0) j++;
   Karte[i].Bild-&gt;OnClick = Bildclick;
   }
}
</code></pre>
<p>Ich danke euch schonmal für eure Hilfe!!!</p>
<p>Muchas Gracias y Saludos</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/133401/komponenten-images-während-der-laufzeit-erzeugen-und-event-onclick-zuweisen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 31 Jul 2026 15:42:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/133401.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 17 Jan 2006 13:56:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Komponenten (Images) während der Laufzeit erzeugen und Event (OnClick) zuweisen on Tue, 17 Jan 2006 13:56:03 GMT]]></title><description><![CDATA[<p>Hallo alle zusammen...</p>
<p>Ich hab 12 Images dynamisch mit Hilfe eines Arrays erzeugt und hab allen 12 Image ein und das selbe Bild (durch loadfromfile) zugewiesen. Jetzt möchte ich, dass wenn ich ein Bild anklicke ein anderes Bild (aber je nach Position im Array ein anderes) geladen/angezeigt wird. Ich programmiere mit dem C++ Builder 6.</p>
<p>Mein code zum erzeugen und Bild laden sieht wie folgt aus:</p>
<pre><code class="language-cpp">void __fastcall TForm1::Button1Click(TObject *Sender)
{
int j = 0;
int x = 0;
for (int i = 1; i &lt;13; i++)
   {
   if (x == 4) x = 0;
   Karte[i].Bild = new TImage(this);
   Karte[i].Bild-&gt;Picture-&gt;LoadFromFile(&quot;karte.bmp&quot;);
   Karte[i].Bild-&gt;SetBounds(10+134*x,10+134*j,124,124);
   Karte[i].Bild-&gt;Parent = this;
   x++;
   if (i % 4 == 0) j++;
   Karte[i].Bild-&gt;OnClick = Bildclick;
   }
}
</code></pre>
<p>Ich danke euch schonmal für eure Hilfe!!!</p>
<p>Muchas Gracias y Saludos</p>
]]></description><link>https://www.c-plusplus.net/forum/post/968918</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/968918</guid><dc:creator><![CDATA[papamarco]]></dc:creator><pubDate>Tue, 17 Jan 2006 13:56:03 GMT</pubDate></item><item><title><![CDATA[Reply to Komponenten (Images) während der Laufzeit erzeugen und Event (OnClick) zuweisen on Tue, 17 Jan 2006 14:17:29 GMT]]></title><description><![CDATA[<p>papamarco schrieb:</p>
<blockquote>
<p>Ich hab 12 Images dynamisch mit Hilfe eines Arrays erzeugt und hab allen 12 Image ein und das selbe Bild (durch loadfromfile) zugewiesen. Jetzt möchte ich, dass wenn ich ein Bild anklicke ein anderes Bild (aber je nach Position im Array ein anderes) geladen/angezeigt wird.</p>
</blockquote>
<p>gut.. melde dich hier wenn du ne konkrete Frage hast.</p>
<p>papamarco schrieb:</p>
<blockquote>
<p>Ich danke euch schonmal für eure Hilfe!!!</p>
</blockquote>
<p>Bitte, gerngeschen <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>
<p>mfg<br />
BigNeal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/968940</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/968940</guid><dc:creator><![CDATA[BigNeal]]></dc:creator><pubDate>Tue, 17 Jan 2006 14:17:29 GMT</pubDate></item><item><title><![CDATA[Reply to Komponenten (Images) während der Laufzeit erzeugen und Event (OnClick) zuweisen on Tue, 17 Jan 2006 14:34:12 GMT]]></title><description><![CDATA[<p>Steht doch alles in der <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39206.html" rel="nofollow">FAQ</a> Abschnitt Komponenten benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/968958</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/968958</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 17 Jan 2006 14:34:12 GMT</pubDate></item><item><title><![CDATA[Reply to Komponenten (Images) während der Laufzeit erzeugen und Event (OnClick) zuweisen on Tue, 17 Jan 2006 16:27:13 GMT]]></title><description><![CDATA[<p>Braunstein schrieb:</p>
<blockquote>
<p>Steht doch alles in der <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39206.html" rel="nofollow">FAQ</a> Abschnitt Komponenten benutzen.</p>
</blockquote>
<p>Die FAQ hab ich schon gelesen, aber das hilft mir nicht weiter.</p>
<p>Hatte jetzt folgende Idee:</p>
<pre><code>void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
for (int i = 1; i &lt; 13; i++)
   if (Karte[i].Bild-&gt;OnClick)
      Karte[i].Bild-&gt;Picture-&gt;LoadFromFile(IntToStr(i)+&quot;.bmp&quot;);
</code></pre>
<p>Aber er zeigt mir hier jedesmal beim ausführen einen Fehler &quot;Access violation...&quot; an <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
<p>Ich will nicht für jedes Bild eine Funktion der Art</p>
<pre><code>Karte[1].Bild-&gt;OnClick = Bildclick1;
Karte[2].Bild-&gt;OnClick = Bildclick2;
...
</code></pre>
<p>schreiben und dann in jeder Funktion das entsprechende neue Bild laden<br />
Geht das nicht irgendwie einfacher?(Frage!!!)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/969093</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969093</guid><dc:creator><![CDATA[papamarco]]></dc:creator><pubDate>Tue, 17 Jan 2006 16:27:13 GMT</pubDate></item><item><title><![CDATA[Reply to Komponenten (Images) während der Laufzeit erzeugen und Event (OnClick) zuweisen on Tue, 17 Jan 2006 16:35:56 GMT]]></title><description><![CDATA[<p>Dir reicht doch eine OnClick-Funktion, die dann allen Images zuweist. Mit Hilfe dieses <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39210.html" rel="nofollow">FAQ-Eintrages</a> kannst du dann in dieser OnClick-Funktion rausbekommen welches Image angeklickt wurde. Evtl. hilft das hier noch<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-132671.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-132671.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/969100</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/969100</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 17 Jan 2006 16:35:56 GMT</pubDate></item></channel></rss>