<?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[TComboBox zur Laufzeit generiert]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe in meiner Applikation ein TStringGrid und möchte eine TComboBox anzeigen, wenn auf Spalte 3 geclickt wird, das hab' ich mit folgendem Code realisiert:</p>
<pre><code class="language-cpp">TComboBox *temp_CB=NULL;
    if( Reftab_SG-&gt;Col != 3)
      {
      ModeHinweis_Mem-&gt;Hide();  // HinweisPanel für Mode verstecken
      if (temp_CB)
        {
        temp_CB-&gt;Visible=false;
        delete temp_CB; temp_CB=NULL;
        }
      }
    else
      {
      ModeHinweis_Mem-&gt;Show(); // HinweisPanel für Mode anzeigen
      if (lan)
        {
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Mode:&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 1&amp;0: 0=Gesch.mode, 1=absolut Pos. mode, 2=relativ Pos. mode&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 4: 1=Absolute Zeit(gesamter Fahrauftrag), 0=Zeit nach Fahrauftrag&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 5: 1=Stop nach diesem Fahrauftrag, 0=fortsetzen bei nächstem Fahrauftrag&quot;);
        }
      else
        {
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Mode:&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 1&amp;0: 0=Speedmode, 1=absolute Pos. mode, 2=relative Pos. mode&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 4: 1=Absolute Time(whole mov. Cmd), 0=Time after mov. Cmd&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 5: 1=Stop after this mov. Cmd, 0=Continue with next mov. Cmd&quot;);
        }
      if (temp_CB)  // existierende ComboBox löschen
        {
        temp_CB-&gt;Visible=false;
        delete temp_CB; temp_CB=NULL;
        }
      temp_CB=new TComboBox(this);
      temp_CB-&gt;Parent=Referenz_Pnl;
      temp_CB-&gt;Style=csDropDownList;
      temp_CB-&gt;OnChange = temp_CBChange;
      temp_CB-&gt;Left=Reftab_SG-&gt;Left;
      temp_CB-&gt;Height=Reftab_SG-&gt;DefaultRowHeight;
      temp_CB-&gt;Top=Reftab_SG-&gt;Top;
      temp_CB-&gt;Visible=true;
      temp_CB-&gt;Items-&gt;Add(&quot;Bit 1&amp;0: 0=Speedmode, 1=absolute Pos. mode, 2=relative Pos. mode&quot;);
      temp_CB-&gt;Items-&gt;Add(&quot;Bit 4: 1=Absolute Time(whole mov. Cmd), 0=Time after mov. Cmd&quot;);
      temp_CB-&gt;Items-&gt;Add(&quot;Bit 5: 1=Stop after this mov. Cmd, 0=Continue with next mov. Cmd&quot;);
      /*** [Code for positioning] ***/
      TRect Rect = Reftab_SG-&gt;CellRect(Reftab_SG-&gt;Col,Reftab_SG-&gt;Row);
      temp_CB-&gt;Top = Reftab_SG-&gt;Top;
      temp_CB-&gt;Left = Reftab_SG-&gt;Left;
      temp_CB-&gt;Text = EmptyStr;
      temp_CB-&gt;Top = temp_CB-&gt;Top + Rect.Top + Reftab_SG-&gt;GridLineWidth;
      temp_CB-&gt;Left = temp_CB-&gt;Left + Rect.Left + Reftab_SG-&gt;GridLineWidth;
      temp_CB-&gt;Height = (Rect.Bottom - Rect.Top);
      temp_CB-&gt;Width = (Rect.Right - Rect.Left) + 2;
      temp_CB-&gt;Visible = true;
      temp_CB-&gt;SetFocus();
      /*** [/Code for positioning] ***/
      }
</code></pre>
<p>Nach mir, sollte das so funktionieren, die ComboBox erscheint bei click auf Zeile 3 auch ganz sauber, aaaaaaaaber sie verschwindet nicht mehr, troz <em>temp_CB-&gt;Visible=false;</em> wesshalb? Was hab' ich da übersehen?<br />
Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/98163/tcombobox-zur-laufzeit-generiert</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 01:44:18 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/98163.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 Jan 2005 09:38:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TComboBox zur Laufzeit generiert on Mon, 17 Jan 2005 09:38:22 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe in meiner Applikation ein TStringGrid und möchte eine TComboBox anzeigen, wenn auf Spalte 3 geclickt wird, das hab' ich mit folgendem Code realisiert:</p>
<pre><code class="language-cpp">TComboBox *temp_CB=NULL;
    if( Reftab_SG-&gt;Col != 3)
      {
      ModeHinweis_Mem-&gt;Hide();  // HinweisPanel für Mode verstecken
      if (temp_CB)
        {
        temp_CB-&gt;Visible=false;
        delete temp_CB; temp_CB=NULL;
        }
      }
    else
      {
      ModeHinweis_Mem-&gt;Show(); // HinweisPanel für Mode anzeigen
      if (lan)
        {
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Mode:&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 1&amp;0: 0=Gesch.mode, 1=absolut Pos. mode, 2=relativ Pos. mode&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 4: 1=Absolute Zeit(gesamter Fahrauftrag), 0=Zeit nach Fahrauftrag&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 5: 1=Stop nach diesem Fahrauftrag, 0=fortsetzen bei nächstem Fahrauftrag&quot;);
        }
      else
        {
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Mode:&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 1&amp;0: 0=Speedmode, 1=absolute Pos. mode, 2=relative Pos. mode&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 4: 1=Absolute Time(whole mov. Cmd), 0=Time after mov. Cmd&quot;);
        ModeHinweis_Mem-&gt;Lines-&gt;Add(&quot;Bit 5: 1=Stop after this mov. Cmd, 0=Continue with next mov. Cmd&quot;);
        }
      if (temp_CB)  // existierende ComboBox löschen
        {
        temp_CB-&gt;Visible=false;
        delete temp_CB; temp_CB=NULL;
        }
      temp_CB=new TComboBox(this);
      temp_CB-&gt;Parent=Referenz_Pnl;
      temp_CB-&gt;Style=csDropDownList;
      temp_CB-&gt;OnChange = temp_CBChange;
      temp_CB-&gt;Left=Reftab_SG-&gt;Left;
      temp_CB-&gt;Height=Reftab_SG-&gt;DefaultRowHeight;
      temp_CB-&gt;Top=Reftab_SG-&gt;Top;
      temp_CB-&gt;Visible=true;
      temp_CB-&gt;Items-&gt;Add(&quot;Bit 1&amp;0: 0=Speedmode, 1=absolute Pos. mode, 2=relative Pos. mode&quot;);
      temp_CB-&gt;Items-&gt;Add(&quot;Bit 4: 1=Absolute Time(whole mov. Cmd), 0=Time after mov. Cmd&quot;);
      temp_CB-&gt;Items-&gt;Add(&quot;Bit 5: 1=Stop after this mov. Cmd, 0=Continue with next mov. Cmd&quot;);
      /*** [Code for positioning] ***/
      TRect Rect = Reftab_SG-&gt;CellRect(Reftab_SG-&gt;Col,Reftab_SG-&gt;Row);
      temp_CB-&gt;Top = Reftab_SG-&gt;Top;
      temp_CB-&gt;Left = Reftab_SG-&gt;Left;
      temp_CB-&gt;Text = EmptyStr;
      temp_CB-&gt;Top = temp_CB-&gt;Top + Rect.Top + Reftab_SG-&gt;GridLineWidth;
      temp_CB-&gt;Left = temp_CB-&gt;Left + Rect.Left + Reftab_SG-&gt;GridLineWidth;
      temp_CB-&gt;Height = (Rect.Bottom - Rect.Top);
      temp_CB-&gt;Width = (Rect.Right - Rect.Left) + 2;
      temp_CB-&gt;Visible = true;
      temp_CB-&gt;SetFocus();
      /*** [/Code for positioning] ***/
      }
</code></pre>
<p>Nach mir, sollte das so funktionieren, die ComboBox erscheint bei click auf Zeile 3 auch ganz sauber, aaaaaaaaber sie verschwindet nicht mehr, troz <em>temp_CB-&gt;Visible=false;</em> wesshalb? Was hab' ich da übersehen?<br />
Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/698525</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/698525</guid><dc:creator><![CDATA[roN]]></dc:creator><pubDate>Mon, 17 Jan 2005 09:38:22 GMT</pubDate></item><item><title><![CDATA[Reply to TComboBox zur Laufzeit generiert on Mon, 17 Jan 2005 09:42:17 GMT]]></title><description><![CDATA[<p>ah ist ja logisch, ich muss die Variable als private global in der Klasse deklarieren, sorry für eure Zeitverschwendung</p>
]]></description><link>https://www.c-plusplus.net/forum/post/698533</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/698533</guid><dc:creator><![CDATA[roN]]></dc:creator><pubDate>Mon, 17 Jan 2005 09:42:17 GMT</pubDate></item><item><title><![CDATA[Reply to TComboBox zur Laufzeit generiert on Mon, 17 Jan 2005 09:46:51 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>roN schrieb:</p>
<blockquote>
<p>ah ist ja logisch, ich muss die Variable als private global in der Klasse deklarieren, sorry für eure Zeitverschwendung</p>
</blockquote>
<p>hehe, lustiger Fehler. Ist mir aber auch schon passiert. Übrigens nennt man das nicht global in der Klasse, sondern Member der Klasse, nur so um saubere Bezeichnungen zu verwenden.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/698538</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/698538</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 17 Jan 2005 09:46:51 GMT</pubDate></item></channel></rss>