<?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[TEdit-Arrays und OnChange()]]></title><description><![CDATA[<p>Hallo,<br />
ich lege zwei gleichgroße TEdit-Arrays zur Laufzeit an.<br />
Nun möchte ich, wenn in ein Edit &quot;edSatz[i]&quot; des ersten Arrays etwas eingetippt wird, dass in dem Edit mit dem gleichen Index &quot;edUmsatz[i]&quot; des zweiten Arrays etwas ausgerechnet wird, z.B.: edUmsatz[i].Text = edSatz[i].Text * 70 (ohne Typumwandlungen).<br />
Wie kann ich ein OnChange-Ereignis schreiben, in dem beide miteinander kommunizieren können?</p>
<p>Danke,</p>
<p>Thomas</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/138534/tedit-arrays-und-onchange</link><generator>RSS for Node</generator><lastBuildDate>Sun, 02 Aug 2026 17:36:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/138534.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 Feb 2006 11:20:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TEdit-Arrays und OnChange() on Mon, 27 Feb 2006 11:27:07 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich lege zwei gleichgroße TEdit-Arrays zur Laufzeit an.<br />
Nun möchte ich, wenn in ein Edit &quot;edSatz[i]&quot; des ersten Arrays etwas eingetippt wird, dass in dem Edit mit dem gleichen Index &quot;edUmsatz[i]&quot; des zweiten Arrays etwas ausgerechnet wird, z.B.: edUmsatz[i].Text = edSatz[i].Text * 70 (ohne Typumwandlungen).<br />
Wie kann ich ein OnChange-Ereignis schreiben, in dem beide miteinander kommunizieren können?</p>
<p>Danke,</p>
<p>Thomas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1003984</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1003984</guid><dc:creator><![CDATA[wieczo]]></dc:creator><pubDate>Mon, 27 Feb 2006 11:27:07 GMT</pubDate></item><item><title><![CDATA[Reply to TEdit-Arrays und OnChange() on Mon, 27 Feb 2006 14:36:32 GMT]]></title><description><![CDATA[<p>Im OnChange des &quot;edSatz[i]&quot;</p>
<p>edUmsatz[i].Text = edSatz[i].Text * 70 mit Typenumwandlung -&gt; mit Text (String) kann man nicht rechnen</p>
<blockquote>
<p>Wie kann ich ein OnChange-Ereignis schreiben, in dem beide miteinander kommunizieren können?</p>
</blockquote>
<p>Sehe jetzt nicht, dass beide kommunizieren müsssen.</p>
<p>Sollten sie das doch müssen (beide OnChange zugleich aktiv) dann musst du in den jeweiligen OnChange Ereignissen das andere solange tot legen (auf Null setzen) sonst gibt's ärger</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1004215</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1004215</guid><dc:creator><![CDATA[Christian211]]></dc:creator><pubDate>Mon, 27 Feb 2006 14:36:32 GMT</pubDate></item><item><title><![CDATA[Reply to TEdit-Arrays und OnChange() on Tue, 28 Feb 2006 15:35:23 GMT]]></title><description><![CDATA[<p>Ja, ich weiß, dass man Typumwandlung braucht, habe sie aber weggelassen, um es kurz zu fassen.<br />
Mein Problem ist jetzt, dass immer wenn &quot;i = TEdit(Sender).Tag&quot; ausgeführt wird, i=0 rauskommt. Ich benutze das hier als OnChange()-Ereignis:</p>
<pre><code class="language-cpp">void __fastcall TfrmControl::Edit1Change(TObject *Sender)
{
     float fSatz;
     int i = TEdit(Sender).Tag;
     AnsiString sEdit = edSatz[i]-&gt;Text;

     if (sEdit != &quot;&quot;)
     {
          try
          {

              fSatz = StrToFloat(sEdit);
              if (fSatz &gt; 0)
              {
                 float fHours = StrToFloat(lblTime[TEdit(Sender).Tag]-&gt;Caption);
                 AnsiString sUmsatz = FloatToStr(fHours * fSatz);
                 edSum[TEdit(Sender).Tag]-&gt;Text = sUmsatz;
              }
          }
          catch (Exception &amp;E)
          {
          }
     }
}
</code></pre>
<p>Definiert und erzeugt werden die TEdit und TLabel Arrays so:</p>
<pre><code class="language-cpp">DynamicArray&lt;TLabel*&gt;lblProj;
DynamicArray&lt;TLabel*&gt;lblTime;
DynamicArray&lt;TEdit*&gt;edSatz;
DynamicArray&lt;TEdit*&gt;edSum;

void __fastcall TfrmControl::FormShow(TObject *Sender)
{
    TADODataSet * ds = DB-&gt;dsRepProjects;
    AnsiString sql = TIMEENTRIES_SELECT_REP_PROJ_EMPLOYEE;

    // Zuerst Daten aus der Datenbank laden
    try
    {
        int i = 0;
        ds-&gt;Active=false;
        ds-&gt;CommandText = sql;
        ds-&gt;Parameters-&gt;Items[i++]-&gt;Value = pDT-&gt;TruncDay( DateFrom );
        ds-&gt;Parameters-&gt;Items[i++]-&gt;Value = pDT-&gt;TruncDay( DateTo ) + TDateTime(1);
        ds-&gt;Parameters-&gt;Items[i++]-&gt;Value = PersonalNumber;
        ds-&gt;Active = true;
    }
    catch ( Exception &amp;E )
    {
        ShowMessage( E.Message );
    }

    // ==&gt;HIER WERDEN DIE ARRAYS GEFÜLLT!!!&lt;==
    int iLength = ds-&gt;RecordCount;
    try
    {
        int i = 0;
        if (iLength &gt; 0)
        {
            lblProj.Length = iLength;
            lblTime.Length = iLength;
            edSatz.Length = iLength;
            edSum.Length = iLength;
        }
        while (!ds-&gt;Eof)
        {
            lblProj[i] = new TLabel(this);
            lblProj[i]-&gt;Parent = this;
            lblProj[i]-&gt;Caption = ds-&gt;FieldByName(&quot;ProjectNumber&quot;)-&gt;AsString;
            lblProj[i]-&gt;Top = 32 * i + 56;
            lblProj[i]-&gt;Left = 8;
            lblProj[i]-&gt;Tag = i;
            lblProj[i]-&gt;Show();

            lblTime[i] = new TLabel(this);
            lblTime[i]-&gt;Parent = this;
            lblTime[i]-&gt;Caption = ds-&gt;FieldByName(&quot;Expr1002&quot;)-&gt;AsString;
            lblTime[i]-&gt;Top = 32 * i + 56;
            lblTime[i]-&gt;Left = 120;
            lblTime[i]-&gt;Tag = i;
            lblTime[i]-&gt;Show();

            edSatz[i] = new TEdit(this);
            edSatz[i]-&gt;Parent = this;
            edSatz[i]-&gt;Text = &quot;&quot;;
            edSatz[i]-&gt;Top = 32 * i + 48;
            edSatz[i]-&gt;Left = 240;
            edSatz[i]-&gt;Width = 73;
            edSatz[i]-&gt;Tag = i;
            edSatz[i]-&gt;Show();
            edSatz[i]-&gt;OnChange = Edit1Change;

            edSum[i] = new TEdit(this);
            edSum[i]-&gt;Parent = this;
            edSum[i]-&gt;Text = &quot;&quot;;
            edSum[i]-&gt;Top = 32 * i + 48;
            edSum[i]-&gt;Left = 360;
            edSum[i]-&gt;Width = 81;
            edSum[i]-&gt;Tag = i;
            edSum[i]-&gt;Show();

            i++;
            ds-&gt;Next();
        }
    }
    catch ( Exception &amp;E )
    {
        ShowMessage( E.Message );
    }
}
</code></pre>
<p>Die Tags werden in FormShow() erfolgreich aus gefüllt, dennoch gibt es den Fehler im OnChange()-Ereignis.<br />
Sieht jemand meinen Fehler? Wieso ist das Tag jedes Edits, das OnChange() auslöst gleich 0? Ich vermute das liegt an &quot;TEdit(Sender).Tag&quot;.</p>
<p>Danke, Thomas <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1005169</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005169</guid><dc:creator><![CDATA[wieczo]]></dc:creator><pubDate>Tue, 28 Feb 2006 15:35:23 GMT</pubDate></item><item><title><![CDATA[Reply to TEdit-Arrays und OnChange() on Tue, 28 Feb 2006 16:09:02 GMT]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">int x = TEdit(Sender).Tag // falsch
int y = static_cast&lt;TEdit*&gt;(Sender)-&gt;Tag // richtig
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005225</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 28 Feb 2006 16:09:02 GMT</pubDate></item><item><title><![CDATA[Reply to TEdit-Arrays und OnChange() on Wed, 01 Mar 2006 09:31:48 GMT]]></title><description><![CDATA[<p>Viel Dank, Akari. <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1005732</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005732</guid><dc:creator><![CDATA[wieczo]]></dc:creator><pubDate>Wed, 01 Mar 2006 09:31:48 GMT</pubDate></item></channel></rss>