<?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[Probleme beim Message-Handling]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe folgendes Problem:<br />
In einer SDI-Anwendung, in der eine grafische GUI direkt per pDC im View erzeugt wird soll programmgesteuert einen ComboBox an einer bestimmten Position erscheinen, aus der was ausgewählt wird und nach der Auswahl wieder verschwinden.</p>
<p>Also, so dachte ich es mit jedenfalls, habe ich eine neue Klasse &quot;CCombo2&quot; gebastelt, die nix anderes macht, als eine CComboBox an einer Position X/Y zu erzeugen, zu befüllen und dann auf ne Aktion zu warten um diese zu behandeln und die Box verschwinden zu lassen.</p>
<pre><code class="language-cpp">CCombo2::CCombo2(CRect position, CWnd* pParentWnd)
: box(NULL)
, SelectedValue(_T(&quot;&quot;))
{
	GetMessageMap();
	box = new CComboBox();
	box-&gt;Create(WS_CHILD|WS_VISIBLE|WS_VSCROLL|CBS_DROPDOWNLIST, position, pParentWnd, IDC_DROPDOWN_MAINVIEW);
}
</code></pre>
<p>Hierfür habe ich ne MessageMap bebastelt, in der praktisch alle Events der CComboBox (siehe MSDN) abgefangen werden sollen und auf eine Funktion gelenkt werden.</p>
<pre><code class="language-cpp">BEGIN_MESSAGE_MAP(CCombo2, CComboBox)
	ON_CBN_CLOSEUP(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_SELCHANGE(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_KILLFOCUS(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::CloseBox)
	ON_CBN_DBLCLK(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_DROPDOWN(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_EDITCHANGE(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_EDITUPDATE(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_ERRSPACE(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_SELENDCANCEL(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_SELENDOK(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_SETFOCUS(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
END_MESSAGE_MAP()
</code></pre>
<p>Damit ich sehe, was passiert habe ich mir auf diese Funktion nen Breakpoint gelegt und meine Box erzeugen lassen.<br />
Aber leider ist nix passiert...</p>
<pre><code class="language-cpp">void CComboBoy::OnDropDownSelect(void)
{
	CString strSelected;
	int index = box-&gt;GetCurSel();

	if( index != CB_ERR )
	{
		this-&gt;box-&gt;GetLBText(index, strSelected);
		this-&gt;SelectedValue = strSelected;
	}
}
</code></pre>
<p>Kann mir da jemand Hilfestellung geben?<br />
Ich weiß schön langsam nicht mehr, wo ich nachschauen soll...</p>
<p>Danke schon mal!</p>
<p>J.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/160160/probleme-beim-message-handling</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Jul 2026 11:20:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/160160.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 Sep 2006 14:06:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme beim Message-Handling on Fri, 22 Sep 2006 14:07:01 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe folgendes Problem:<br />
In einer SDI-Anwendung, in der eine grafische GUI direkt per pDC im View erzeugt wird soll programmgesteuert einen ComboBox an einer bestimmten Position erscheinen, aus der was ausgewählt wird und nach der Auswahl wieder verschwinden.</p>
<p>Also, so dachte ich es mit jedenfalls, habe ich eine neue Klasse &quot;CCombo2&quot; gebastelt, die nix anderes macht, als eine CComboBox an einer Position X/Y zu erzeugen, zu befüllen und dann auf ne Aktion zu warten um diese zu behandeln und die Box verschwinden zu lassen.</p>
<pre><code class="language-cpp">CCombo2::CCombo2(CRect position, CWnd* pParentWnd)
: box(NULL)
, SelectedValue(_T(&quot;&quot;))
{
	GetMessageMap();
	box = new CComboBox();
	box-&gt;Create(WS_CHILD|WS_VISIBLE|WS_VSCROLL|CBS_DROPDOWNLIST, position, pParentWnd, IDC_DROPDOWN_MAINVIEW);
}
</code></pre>
<p>Hierfür habe ich ne MessageMap bebastelt, in der praktisch alle Events der CComboBox (siehe MSDN) abgefangen werden sollen und auf eine Funktion gelenkt werden.</p>
<pre><code class="language-cpp">BEGIN_MESSAGE_MAP(CCombo2, CComboBox)
	ON_CBN_CLOSEUP(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_SELCHANGE(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_KILLFOCUS(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::CloseBox)
	ON_CBN_DBLCLK(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_DROPDOWN(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_EDITCHANGE(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_EDITUPDATE(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_ERRSPACE(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_SELENDCANCEL(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_SELENDOK(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
	ON_CBN_SETFOCUS(IDC_DROPDOWN_MAINVIEW, &amp;CCombo2::OnDropDownSelect)
END_MESSAGE_MAP()
</code></pre>
<p>Damit ich sehe, was passiert habe ich mir auf diese Funktion nen Breakpoint gelegt und meine Box erzeugen lassen.<br />
Aber leider ist nix passiert...</p>
<pre><code class="language-cpp">void CComboBoy::OnDropDownSelect(void)
{
	CString strSelected;
	int index = box-&gt;GetCurSel();

	if( index != CB_ERR )
	{
		this-&gt;box-&gt;GetLBText(index, strSelected);
		this-&gt;SelectedValue = strSelected;
	}
}
</code></pre>
<p>Kann mir da jemand Hilfestellung geben?<br />
Ich weiß schön langsam nicht mehr, wo ich nachschauen soll...</p>
<p>Danke schon mal!</p>
<p>J.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1142605</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1142605</guid><dc:creator><![CDATA[jholzer]]></dc:creator><pubDate>Fri, 22 Sep 2006 14:07:01 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme beim Message-Handling on Fri, 22 Sep 2006 14:25:46 GMT]]></title><description><![CDATA[<p>Falscher Ansatz. Du hast korrekt abgeleitet von CComboBox aber du darfst nicht in der Klasse wieder ein neues CComboBox Objekt erzeugen. Rufe direkt Create deine neuen CCombo2 Klasse auf!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1142617</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1142617</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 22 Sep 2006 14:25:46 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme beim Message-Handling on Fri, 22 Sep 2006 14:37:20 GMT]]></title><description><![CDATA[<p>Erst mal Danke für die schnelle Antwort!</p>
<p>Ich habe jetzt meinen Konstruktor wie folgt geändert:</p>
<pre><code class="language-cpp">CComboBoy::CComboBoy(CRect position, CWnd* pParentWnd)
: box(NULL)
, SelectedValue(_T(&quot;&quot;))
{
	GetMessageMap();
	this-&gt;Create(WS_CHILD|WS_VISIBLE|WS_VSCROLL|CBS_DROPDOWNLIST, position, pParentWnd, IDC_DROPDOWN_MAINVIEW);
}
</code></pre>
<p>Das Combo wird dann auch anstandslos erzeugt. Aber leider wieder mit dem selben Effekt, dass meine Messages nicht in der o.g. Routine ankommen...</p>
<p>Kleiner Hinweis noch:<br />
Die ID &quot;IDC_DROPDOWN_MAINVIEW&quot; habe ich manuell in der &quot;resource.h&quot; mit einer uInt-ID definiert. Kann es sein, dass ich die noch irgendwo anders eintragen muss, damit das Messaging funktioniert?</p>
<p>Was mir noch aufgefallen ist:<br />
Wenn ich im Konstruktor nicht explizit die GetMessageMap() aufrufe werden die Makros zum erzeugen der Map nicht abgearbeitet (habe einfach am Anfang der Definition nen Break gesetz und geschaut ob er angelaufen wird)<br />
Deutet das evtl noch auf irgendwas hin? Hab ich da vielleicht noch irgendwo was wichtiges vergessen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1142626</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1142626</guid><dc:creator><![CDATA[jholzer]]></dc:creator><pubDate>Fri, 22 Sep 2006 14:37:20 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme beim Message-Handling on Fri, 22 Sep 2006 15:16:44 GMT]]></title><description><![CDATA[<p>Den Aufruf von GetMessageMap kannst Du vergessen!</p>
<p>Ich sehe erst jetzt, dass die ganzen Nachrichten, die Du abfangen möchtest grundsätzlich an das Parent gehen. Möchtest Du diese nachrichten auch im Control selbst bearbeiten, müsstest Du diese in OnChildNotify bearbeiten!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1142650</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1142650</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 22 Sep 2006 15:16:44 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme beim Message-Handling on Mon, 25 Sep 2006 06:07:45 GMT]]></title><description><![CDATA[<p>Die Antworten sollen in diesem Control selbst verarbeitet werden.<br />
Es soll nix nach aussen geleitet werden...</p>
<p>Vom Prinzip her soll´s so ausschauen:</p>
<p>Control über Konstruktur erzeugen<br />
-&gt;Dropdownlist erscheint in meinem Zeichenkontext</p>
<p>Auswahl irgendeines Elementes<br />
-&gt;Dropdown verschwindet und auswahl wird in der &quot;SelectedIrgendwas&quot; gespeichert und kann von aussen abgegriffen werden</p>
<p>Klick irgendwoausserhalb der Dropdowns<br />
-&gt;Dropdown verschwindet nur und &quot;SelectedIrgendwas&quot; bleibt leer.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1143714</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1143714</guid><dc:creator><![CDATA[jholzer]]></dc:creator><pubDate>Mon, 25 Sep 2006 06:07:45 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme beim Message-Handling on Mon, 25 Sep 2006 08:16:55 GMT]]></title><description><![CDATA[<p>Hab´s hingekriegt!</p>
<p>Das mit dem &quot;OnChildNotification&quot; hat geholfen.</p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1143803</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1143803</guid><dc:creator><![CDATA[jholzer]]></dc:creator><pubDate>Mon, 25 Sep 2006 08:16:55 GMT</pubDate></item></channel></rss>