<?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[Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!?]]></title><description><![CDATA[<p>Hallo,</p>
<p>der Titel hört sich villeicht etwas komisch an, denn ich schreibe zurzeit an einem &quot;Matheprogramm&quot; und habe ein Problem bei einer &quot;if-struktur&quot; (glaube ich zumindest)! Ich möchte, dass wenn verschiedene Radiobuttons gedrückt(Checked) werden, jeweils verschiedene Rechnungen durchgeführt werden.</p>
<p>Hier ein Beispiel wie es versucht habe:</p>
<p>(Kreisberechnung)</p>
<pre><code>void __fastcall TForm1::ErgebnisButtonClick(TObject *Sender)
{

if(Funktion[0]) // Umfang (Kreis)
{
  float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
  String Ergebnis = FloatToStr(2 * r * PI);
  Panel1-&gt;Caption = Ergebnis;
  StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Umfang: &quot; + Ergebnis;
}

else if(Funktion[1]) // Flächeninhalt (Kreis)
{
  float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
  String Ergebnis = FloatToStr(PI * r * r);
  Panel1-&gt;Caption = Ergebnis;
  StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Flächeninhalt: &quot; + Ergebnis;
}

}

void __fastcall TForm1::RadioButton1Click(TObject *Sender)
{
Funktion[0] = RadioButton1-&gt;Checked;  // Umfang
}

void __fastcall TForm1::RadioButton2Click(TObject *Sender)
{
Funktion[1] = RadioButton2-&gt;Checked;  // Flächeninhalt
}
</code></pre>
<p>-&gt; Und zwar wechselt sich das Ergebnis <strong>nie</strong>, wenn ich zwischen den beiden Radiobuttons wechsel ?!? - Es bleibt immer gleich wenn ich einmal den Radiobutton für den Umfang gedrückt habe, kommt zwar das Ergebnis (des Umfangs), jedoch wenn ich dann den Radiobutton für den Flächeninhalt drücke, bleibt immer noch das &quot;Umfang Ergebnis&quot; stehen - Warum, vom Code her ist doch alles richtig ?!?..</p>
<p>MFG<br />
Sankt M.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/177686/radiobuttons-mit-quot-if-struktur-quot-kombinieren</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 07:47:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/177686.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Apr 2007 01:06:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 01:06:29 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>der Titel hört sich villeicht etwas komisch an, denn ich schreibe zurzeit an einem &quot;Matheprogramm&quot; und habe ein Problem bei einer &quot;if-struktur&quot; (glaube ich zumindest)! Ich möchte, dass wenn verschiedene Radiobuttons gedrückt(Checked) werden, jeweils verschiedene Rechnungen durchgeführt werden.</p>
<p>Hier ein Beispiel wie es versucht habe:</p>
<p>(Kreisberechnung)</p>
<pre><code>void __fastcall TForm1::ErgebnisButtonClick(TObject *Sender)
{

if(Funktion[0]) // Umfang (Kreis)
{
  float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
  String Ergebnis = FloatToStr(2 * r * PI);
  Panel1-&gt;Caption = Ergebnis;
  StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Umfang: &quot; + Ergebnis;
}

else if(Funktion[1]) // Flächeninhalt (Kreis)
{
  float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
  String Ergebnis = FloatToStr(PI * r * r);
  Panel1-&gt;Caption = Ergebnis;
  StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Flächeninhalt: &quot; + Ergebnis;
}

}

void __fastcall TForm1::RadioButton1Click(TObject *Sender)
{
Funktion[0] = RadioButton1-&gt;Checked;  // Umfang
}

void __fastcall TForm1::RadioButton2Click(TObject *Sender)
{
Funktion[1] = RadioButton2-&gt;Checked;  // Flächeninhalt
}
</code></pre>
<p>-&gt; Und zwar wechselt sich das Ergebnis <strong>nie</strong>, wenn ich zwischen den beiden Radiobuttons wechsel ?!? - Es bleibt immer gleich wenn ich einmal den Radiobutton für den Umfang gedrückt habe, kommt zwar das Ergebnis (des Umfangs), jedoch wenn ich dann den Radiobutton für den Flächeninhalt drücke, bleibt immer noch das &quot;Umfang Ergebnis&quot; stehen - Warum, vom Code her ist doch alles richtig ?!?..</p>
<p>MFG<br />
Sankt M.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258263</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258263</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Tue, 03 Apr 2007 01:06:29 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 03:02:36 GMT]]></title><description><![CDATA[<p>Hallo, Sankt M.</p>
<p>probiere es mal so:</p>
<pre><code class="language-cpp">void __fastcall TForm1::ErgebnisButtonClick(TObject *Sender)
{Integer iTag; AnsiString z2,Ergebnis;                                 // Vars definieren

 float r = StrToFloatDef(Edit1-&gt;Text, 0);                              // r = Radius (User)

 iTag=ErgebnisButton-&gt;iTag;                                            // Merker auslesen
 switch(iTag) {                                                        // wie berechnen?
 case 0: Ergebnis = FloatToStr(2*r*PI); z2=&quot; Umfang: &quot;;        break;  // Umfang (Kreis)
 case 1: Ergebnis = FloatToStr(PI*r*r); z2=&quot; Flächeninhalt: &quot;; break;  // Flächeninhalt (Kreis)
 }                                                                     // ende switch(iTag

 Panel1-&gt;Caption = Ergebnis;                                           // Ergebnis schreiben
 StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = z2 + Ergebnis;                   // Infotext
}

void __fastcall TForm1::RadioButton1Click(TObject *Sender)
{ErgebnisButton-&gt;iTag=0;                                               // Merker setzen
}
void __fastcall TForm1::RadioButton2Click(TObject *Sender)
{ErgebnisButton-&gt;iTag=1;                                               // Merker setzen
}
</code></pre>
<p>Gruss Stefan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258269</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258269</guid><dc:creator><![CDATA[Stefan71242]]></dc:creator><pubDate>Tue, 03 Apr 2007 03:02:36 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 05:32:58 GMT]]></title><description><![CDATA[<p>eigentlich sollte es reichen den Status der RadioButtons direkt abzufragen</p>
<pre><code class="language-cpp">void __fastcall TForm1::ErgebnisButtonClick(TObject *Sender)
{
if (RadioButton1-&gt;Checked)
    {
    //...
    }
else if (RadioButton2-&gt;Checked)
    {
    //...
    }
}
</code></pre>
<p>alternativ kannst du auch eine <em>RadioGroup</em> verwenden, dort brauchst du dann nur den <em>ItemIndex</em> abzufragen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258282</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258282</guid><dc:creator><![CDATA[Linnea]]></dc:creator><pubDate>Tue, 03 Apr 2007 05:32:58 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 09:07:02 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>danke funktioniert! Warum kann man das nicht mit einer Variablen (Funktion) mache bzw. Warum funktioniert das nicht ??</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258380</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258380</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Tue, 03 Apr 2007 09:07:02 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 09:17:45 GMT]]></title><description><![CDATA[<p>ganz einfach:<br />
da die Statusänderung des RadioButton nicht nur vom eigenen OnClick-Ereignis abhängt hast du eigentlich nur vergessen den Status aller RadioButtons beim Clicken eines RadioButtons zu ändern, z.B.</p>
<pre><code>void __fastcall TForm1::RadioButton1Click(TObject *Sender)
{
Funktion[0] = RadioButton1-&gt;Checked;  // Umfang
[b]Funktion[1] = RadioButton2-&gt;Checked;[/b]
}

void __fastcall TForm1::RadioButton2Click(TObject *Sender)
{
[b]Funktion[0] = RadioButton1-&gt;Checked;[/b]
Funktion[1] = RadioButton2-&gt;Checked;  // Flächeninhalt
}
</code></pre>
<p>aber wie gesagt, die RadioGroup eignet sich für so etwas besser</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258388</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258388</guid><dc:creator><![CDATA[Linnea]]></dc:creator><pubDate>Tue, 03 Apr 2007 09:17:45 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 12:27:24 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>danke! Ich hab da nochmal eine Bitte und zwar soll der Benutzer verschiedene &quot;Rechenaufgaben&quot; bei dem jeweiligen &quot;MainMenuItem&quot; lösen können!</p>
<p>So habe ich es probiert klappt aber nicht, denn die &quot;Rechenaufgaben&quot; wechseln nicht:</p>
<pre><code>if(K1) // K1 Name des MenuItems
{
  if(RadioButton1-&gt;Checked) // Umfang
  {
    float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
    String Ergebnis = FloatToStr(2 * r * PI);
    Panel1-&gt;Caption = Ergebnis;
    StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Umfang: &quot; + Ergebnis;
  }

  if(RadioButton2-&gt;Checked) // Flächeninhalt
  {
    float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
    String Ergebnis = FloatToStr(PI * r * r);
    Panel1-&gt;Caption = Ergebnis;
    StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Flächeninhalt: &quot; + Ergebnis;
  }
}

if(D1) //D1 Name des MenuItems
{
if(RadioButton1-&gt;Checked) // Umfang
  {
    float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
    String Ergebnis = FloatToStr(2 * r * PI * 3); // Nur zum Test
    Panel1-&gt;Caption = Ergebnis;
    StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Umfang: &quot; + Ergebnis;
  }

  if(RadioButton2-&gt;Checked) // Flächeninhalt
  {
    float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
    String Ergebnis = FloatToStr(PI * r * r * 3); // Nur zum Test
    Panel1-&gt;Caption = Ergebnis;
    StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Flächeninhalt: &quot; + Ergebnis;
  }
}
</code></pre>
<p>Warum wechseln sich die Formeln nicht ?</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258567</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258567</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Tue, 03 Apr 2007 12:27:24 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 12:37:27 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Du hast nicht beachtet das Linnea</p>
<pre><code class="language-cpp">if ... else if ...
</code></pre>
<p>geschrieben hat. Solche Logikfehler sind übrigens ganz leicht mit dem <a href="http://www.junix.ch/bcb/help/debug.html" rel="nofollow">Debugger</a> zu finden.</p>
<p>/Edit : Bitte benutze beim nächsten mal statt den Code-Tags die C++ Tags beim Posten von C++Quellcode hier im Forum.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258576</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 03 Apr 2007 12:37:27 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 17:16:55 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>danke! Ob ich jetzt else if oder if schreibe änder sicht an dem oben beschriebenen Problem nichts : ((...</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258748</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258748</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Tue, 03 Apr 2007 17:16:55 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 17:44:18 GMT]]></title><description><![CDATA[<p>Sankt M. schrieb:</p>
<blockquote>
<pre><code>[b]if(K1)[/b] // K1 Name des MenuItems
{
  if(RadioButton1-&gt;Checked) // Umfang
  {
    //......
  }
}
</code></pre>
<p>Warum wechseln sich die Formeln nicht ?</p>
</blockquote>
<p>Hier wäre wohl auch am besten auf die OnClick-Ereignisse des Menüs zu reagieren. Die Funktion, die beim jeweiligen Menüeintrag ausgeführt werden soll, wird dann im entsprechenden OnClick-Ereignis des Menüs eingefügt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258757</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258757</guid><dc:creator><![CDATA[Fincki]]></dc:creator><pubDate>Tue, 03 Apr 2007 17:44:18 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 18:24:34 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>das steht ja alles in der ButtonClick Methode!</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258777</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258777</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Tue, 03 Apr 2007 18:24:34 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 18:48:03 GMT]]></title><description><![CDATA[<p>Sankt M. schrieb:</p>
<blockquote>
<p>das steht ja alles in der ButtonClick Methode!</p>
</blockquote>
<p>Ich meinte die Click Methode auf dem Menüeintrag.<br />
Was für ein Menü meinst du denn? Mit Radiobuttons oder eher am oberen Bildschirmrand?<br />
Oder allgemein, wie sieht die geplante Benutzerführung aus.</p>
<p>EDIT:</p>
<pre><code>[b]if(K1)[/b] // K1 Name des MenuItems
</code></pre>
<p>Wie wird K1 bestückt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258788</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258788</guid><dc:creator><![CDATA[Fincki]]></dc:creator><pubDate>Tue, 03 Apr 2007 18:48:03 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 20:35:11 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ja ich mein das Menu am oberen &quot;Bildschirmrand&quot; (MainMenu)! Ich hab da einzelne Unterpunkte bei einem Item und zwar ist K1 ner Name von Kreis (Unterpunkt). Wenn man jetzt auf diesen Unterpunkt klickt sollen sich die Formeln bzw. die Aufgaben ändern (siehe mein post). Jetzt wollte ich das ganze mit einer if-struktur realisieren, jedoch ändern sich die Formeln nicht...</p>
<pre><code class="language-cpp">void __fastcall TForm1::ErgebnisButtonClick(TObject *Sender)
{

// Kreisberechnung
if(K1) // Name von Kreis
{
  if(RadioButton1-&gt;Checked) // Umfang
  {
    float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
    String Ergebnis = FloatToStr(2 * r * PI);
    Panel1-&gt;Caption = Ergebnis;
    StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Umfang: &quot; + Ergebnis;
  }

  if(RadioButton2-&gt;Checked) // Flächeninhalt
  {
    float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
    String Ergebnis = FloatToStr(PI * r * r);
    Panel1-&gt;Caption = Ergebnis;
    StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Flächeninhalt: &quot; + Ergebnis;
  }
}

if(T1) Test - um zu sehen, ob sich was verändert...  
{
if(RadioButton1-&gt;Checked) // Umfang
  {
    float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
    String Ergebnis = FloatToStr(2 * r * PI * 3);
    Panel1-&gt;Caption = Ergebnis;
    StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Umfang: &quot; + Ergebnis;
  }

  if(RadioButton2-&gt;Checked) // Flächeninhalt
  {
    float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)
    String Ergebnis = FloatToStr(PI * r * r * 3);
    Panel1-&gt;Caption = Ergebnis;
    StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Flächeninhalt: &quot; + Ergebnis;
  }
}

}
</code></pre>
<p>Ich hab echt keinen Plan, wie ich noch machen könnte...</p>
<p>MFG<br />
Sankt M.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258839</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258839</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Tue, 03 Apr 2007 20:35:11 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 21:22:25 GMT]]></title><description><![CDATA[<p>Ich glaube, dass nur recht wenige Leute (mich ausgeschlossen) sich vorstellen können, was Du programmieren willst. Ein MainMenu, das irgendwie mit der Ereignisbehandlungsroutine eines Buttons in Verbindung steht, mehrere RadioButtons und ein Kreis. Entweder stehe ich gerade sehr auf dem Schlauch, oder Deine Beschreibung ist einfach zu wage, um effektiv helfen zu können.</p>
<p>Warum nutzt Du nicht den Debugger? Schrieb akari bereits...<br />
Warum nutzt Du nicht die Ereignisse des MainMenues und dessen SubItems? Schrieb Fincki bereits...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258855</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258855</guid><dc:creator><![CDATA[Rostfrei**]]></dc:creator><pubDate>Tue, 03 Apr 2007 21:22:25 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Tue, 03 Apr 2007 21:39:31 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich will einfach eine oder mehrere &quot;MenuPunkte&quot; (in diesem Fall Kreis (K1) ), die jeweils verschiedene Formeln, wenn sie gedrückt werden, ausführen.</p>
<p>Ich hab versucht das mit einer if-struktur zu realisieren, jedoch wechselt sich das Ergebnis(Formel) nicht.</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258859</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258859</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Tue, 03 Apr 2007 21:39:31 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Wed, 04 Apr 2007 06:10:14 GMT]]></title><description><![CDATA[<p>K1 und T1 sind also <em>TMenuItem</em>s? wenn ja dann macht deine If-Abfrage keinen Sinn, da du nur den Zeiger abfragst und der ist ja immer da</p>
<p>Sankt M. schrieb:</p>
<blockquote>
<p>Hallo,<br />
ich will einfach eine oder mehrere &quot;MenuPunkte&quot; (in diesem Fall Kreis (K1) ), die jeweils verschiedene Formeln, <strong>wenn sie gedrückt werden</strong>, ausführen.</p>
</blockquote>
<p>dafür gibt es die OnClick-Ereignisse der <em>TMenuItem</em>s</p>
<p>wenn du allerdings die &quot;ErgebnisButtonClick&quot;-Funktion mit den jeweiligen OnClick-Ereignissen des Menüs/RadioButtons verbunden haben solltest, mußt du den Sender auswerten -&gt; siehe <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39210.html" rel="nofollow">FAQ</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258923</guid><dc:creator><![CDATA[Linnea]]></dc:creator><pubDate>Wed, 04 Apr 2007 06:10:14 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Wed, 04 Apr 2007 10:44:48 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie siehts denn aus wenn ich einfach auf das OnClick ereigniss zugreife ? (D1-&gt;OnClick) ; (T1-&gt;OnClick) ??</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259137</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259137</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Wed, 04 Apr 2007 10:44:48 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Wed, 04 Apr 2007 10:49:21 GMT]]></title><description><![CDATA[<p>Sankt M. schrieb:</p>
<blockquote>
<p>Hallo,</p>
<p>wie siehts denn aus wenn ich einfach auf das OnClick ereigniss zugreife ? (D1-&gt;OnClick) ; (T1-&gt;OnClick) ??</p>
<p>MFG</p>
</blockquote>
<p>Um das Ereigniss zu erzeugen klickst du in der IDE auf den Menüeintrag, dann wird automatisch eine Funktion erzeugt:</p>
<pre><code class="language-cpp">void __fastcall TfrmMain::D1Click(TObject *Sender)
{

}
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1259139</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259139</guid><dc:creator><![CDATA[Fincki]]></dc:creator><pubDate>Wed, 04 Apr 2007 10:49:21 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Wed, 04 Apr 2007 11:16:06 GMT]]></title><description><![CDATA[<p>Wie wäre es mit einem Tab-Sheet anstatt einem Menu?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259157</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259157</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Wed, 04 Apr 2007 11:16:06 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Wed, 04 Apr 2007 12:29:31 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">void __fastcall TfrmMain::D1Click(TObject *Sender)
{
ErgebnisButtonClick (Sender);  
}

void __fastcall TfrmMain::T1Click(TObject *Sender)
{
ErgebnisButtonClick (Sender);  
}
</code></pre>
<p>- &quot;so habe ich es gemacht&quot;... - habe zuvor noch nie sowas gemacht...</p>
<p>Funktioniert nicht..</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259242</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259242</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Wed, 04 Apr 2007 12:29:31 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Wed, 04 Apr 2007 12:33:04 GMT]]></title><description><![CDATA[<p>Sankt M. schrieb:</p>
<blockquote>
<p>Funktioniert nicht..</p>
</blockquote>
<p>Hey, klasse Fehlerbeschreibung...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259245</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259245</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Wed, 04 Apr 2007 12:33:04 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Wed, 04 Apr 2007 13:04:01 GMT]]></title><description><![CDATA[<p>@Sankt M.<br />
das ist soweit ja auch nicht falsch, aber hast du dir den Beitrag in der FAQ schonmal angeschaut? das ist nämlich genau das was du in dem Fall brauchst, wobei hier nicht TButton sondern TMenuItem die gesuchte Klasse ist</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259268</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259268</guid><dc:creator><![CDATA[Linnea]]></dc:creator><pubDate>Wed, 04 Apr 2007 13:04:01 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Wed, 04 Apr 2007 23:17:32 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>danke! Jetzt bekomme ich eine Fehlermeldung ('D1' ist kein Element von 'MenuItem') - Warum ??</p>
<pre><code>dynamic_cast&lt;TMenuItem*&gt;(Sender)-&gt;D1;
</code></pre>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259676</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259676</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Wed, 04 Apr 2007 23:17:32 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Thu, 05 Apr 2007 05:58:13 GMT]]></title><description><![CDATA[<p>du solltest dir wirklich nochmal den FAQ Beitrag durchlesen und dabei dein Gehirn anschalten, außerdem empfehle ich die BCB-Hilfe zu <em>TMenuItem</em>, da dort alle Eigenschaften aufgelistet und beschrieben stehen, z.B. die Eigenschaft <em>Name</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259713</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259713</guid><dc:creator><![CDATA[Linnea]]></dc:creator><pubDate>Thu, 05 Apr 2007 05:58:13 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Thu, 05 Apr 2007 10:39:34 GMT]]></title><description><![CDATA[<p>Ohje....</p>
<pre><code class="language-cpp">void __fastcall TForm1::D1Click(TObject *Sender)
{
  dynamic_cast&lt;TMenuItem*&gt;(Sender)-&gt;Name;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::K1Click(TObject *Sender)
{
  dynamic_cast&lt;TMenuItem*&gt;(Sender)-&gt;Name; 
}
</code></pre>
<p>.. Ich weiss ehrlich nicht wie ich das am besten unterbringen soll ... ?</p>
<p>Wie bringe ich das jetzt in eine &quot;if-struktur&quot; ?</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1259910</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259910</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Thu, 05 Apr 2007 10:39:34 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Thu, 05 Apr 2007 11:21:50 GMT]]></title><description><![CDATA[<p>oh man, jetzt wir mir das langsam zu blöd hier</p>
<pre><code class="language-cpp">void __fastcall TfrmMain::D1Click(TObject *Sender) 
{ 
ErgebnisButtonClick (Sender);   
} 
void __fastcall TfrmMain::T1Click(TObject *Sender) 
{ 
ErgebnisButtonClick (Sender);   
} 

void __fastcall TForm1::ErgebnisButtonClick(TObject *Sender) 
{ 
TMenuItem *Item = dynamic_cast&lt;TMenuItem*&gt;(Sender);
if ( !(Item &amp;&amp; Item-&gt;ClassNameIs(&quot;TMenuItem&quot;)) ) return;
if(Item-&gt;Name == &quot;K1&quot;) 
{ 
...
} 
else if(Item-&gt;Name == &quot;T1&quot;)  
{
...
} 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1259942</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1259942</guid><dc:creator><![CDATA[Linnea]]></dc:creator><pubDate>Thu, 05 Apr 2007 11:21:50 GMT</pubDate></item><item><title><![CDATA[Reply to Radiobuttons mit &amp;quot;if-struktur&amp;quot; kombinieren ?!? on Thu, 05 Apr 2007 14:51:31 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>danke funktioniert! Das Problem, das ich jetzt habe ist, dass die &quot;if Anweisungen&quot; in der &quot;if Anweisung&quot; nicht mehr funktionieren. (Das Ergebnis kommt nur durch die Menupunkte (K1 &amp; D1)...</p>
<p>Die Fett markierte Stelle ist die, die nicht funktioniert (wird nicht ignoriert - passiert überhaupt nichts..)</p>
<p>[cpp]void __fastcall TForm1::ErgebnisButtonClick(TObject *Sender)<br />
{<br />
TMenuItem *Item = dynamic_cast&lt;TMenuItem*&gt;(Sender);<br />
if ( !(Item &amp;&amp; Item-&gt;ClassNameIs(&quot;TMenuItem&quot;)) )<br />
return;</p>
<p>// Kreisberechnung<br />
if(Item-&gt;Name == &quot;K1&quot;)<br />
{<br />
**if(RadioButton1-&gt;Checked) // Umfang<br />
{<br />
float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)<br />
String Ergebnis = FloatToStr(2 * r * PI);<br />
Panel1-&gt;Caption = Ergebnis;<br />
StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Umfang: &quot; + Ergebnis;<br />
}</p>
<p>if(RadioButton2-&gt;Checked) // Flächeninhalt<br />
{<br />
float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)<br />
String Ergebnis = FloatToStr(PI * r * r);<br />
Panel1-&gt;Caption = Ergebnis;<br />
StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Flächeninhalt: &quot; + Ergebnis;<br />
}**}</p>
<p>}<br />
else if(Item-&gt;Name == &quot;D1&quot;)<br />
{<br />
**if(RadioButton1-&gt;Checked) // Umfang<br />
{<br />
float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)<br />
String Ergebnis = FloatToStr(r*r*r); //Nur als Beispiel<br />
Panel1-&gt;Caption = Ergebnis;<br />
StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Umfang: &quot; + Ergebnis;<br />
}</p>
<p>if(RadioButton2-&gt;Checked) // Flächeninhalt<br />
{<br />
float r = StrToFloatDef(Edit1-&gt;Text, 0); // r = Radius (User)<br />
String Ergebnis = FloatToStr(PI * r * r) //Nur als Beispiel<br />
Panel1-&gt;Caption = Ergebnis;<br />
StatusBar1-&gt;Panels-&gt;Items[2]-&gt;Text = &quot; Flächeninhalt: &quot; + Ergebnis;<br />
}**}<br />
}<br />
}[/cpp]</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1260194</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1260194</guid><dc:creator><![CDATA[Sankt M.]]></dc:creator><pubDate>Thu, 05 Apr 2007 14:51:31 GMT</pubDate></item></channel></rss>