<?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[Checkbox im CTreeView]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich habe da immernoch ein Problem, wie ich in einem CTreeView auf die Checkboxes reagieren kann.</p>
<p>Wenn ich auf OnClick reagiere, nimmt er mir ja jeden Klick.</p>
<p>Ich möcht, das wenn der User auf ein Übergeordnete Checkbox klickt, alle Child Aktiviert oder nicht Aktiviert sind.</p>
<p>HAt da mir jemand ein Beispiel ??</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/78998/checkbox-im-ctreeview</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 05:23:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/78998.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Jul 2004 08:25:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Checkbox im CTreeView on Wed, 07 Jul 2004 08:25:15 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich habe da immernoch ein Problem, wie ich in einem CTreeView auf die Checkboxes reagieren kann.</p>
<p>Wenn ich auf OnClick reagiere, nimmt er mir ja jeden Klick.</p>
<p>Ich möcht, das wenn der User auf ein Übergeordnete Checkbox klickt, alle Child Aktiviert oder nicht Aktiviert sind.</p>
<p>HAt da mir jemand ein Beispiel ??</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/554997</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/554997</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Wed, 07 Jul 2004 08:25:15 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Wed, 07 Jul 2004 08:41:34 GMT]]></title><description><![CDATA[<p>Ruf in <strong>OnClick</strong> die Funktion <strong>HitTest</strong>auf, und prüfe, ob das Flag <strong>TVHT_ONITEMSTATEICON</strong> in der Struktur <strong>TVHITTESTINFO</strong> gesetzt ist. Dann weißt du, dass in die Checkbox geklickt wurde, und du kannst den Status des angeklickten Eintrages abfragen und dessen Childs entsprechend anpassen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/555010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555010</guid><dc:creator><![CDATA[Uwe Philipps]]></dc:creator><pubDate>Wed, 07 Jul 2004 08:41:34 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Wed, 07 Jul 2004 08:46:04 GMT]]></title><description><![CDATA[<p>void CMyTreeCtrl::OnLButtonDown(UINT nFlags, CPoint point)<br />
{<br />
UINT uFlags=0;<br />
HTREEITEM hItem = HitTest(point,&amp;uFlags);</p>
<p>if (uFlags &amp; TVHT_ONITEM) CDOCloseDlg::instance-&gt;onTreeItem(hItem);<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/555014</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555014</guid><dc:creator><![CDATA[0rp]]></dc:creator><pubDate>Wed, 07 Jul 2004 08:46:04 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Wed, 07 Jul 2004 09:25:19 GMT]]></title><description><![CDATA[<p>Vielen Dank,</p>
<p>Er reagiert mir jetzt aber trotzdem immer noch ein Klick im Tree.</p>
<p>Ich weis nicht genau wohin mit</p>
<p>// TVHT_ONITEMSTATEICON in der Struktur TVHITTESTINFO</p>
<pre><code class="language-cpp">void CAuswahlDialog::OnNMClickListe2(NMHDR *pNMHDR, LRESULT *pResult)
{
         DWORD dw = GetMessagePos();                   
	CPoint point(GET_X_LPARAM(dw), GET_Y_LPARAM(dw)); 
	m_TreeListe.ScreenToClient(&amp;point);

	UINT uFlags=0; 
	hPermanent = m_TreeListe.HitTest(point,&amp;uFlags); 

	if((hPermanent != NULL) &amp;&amp; (TVHT_ONITEM &amp; uFlags))
	{ 
                  // Macht was.....
		AfxMessageBox(&quot;Hallo&quot;);
	}
*pResult = 0;
}
</code></pre>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/555041</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555041</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Wed, 07 Jul 2004 09:25:19 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Wed, 07 Jul 2004 09:41:33 GMT]]></title><description><![CDATA[<p>CTreeCtrl hat noch eine andere <strong>HitTest</strong>-Funktion:</p>
<p>HTREEITEM HitTest( TVHITTESTINFO* pHitTestInfo);</p>
<p>Aber mit deiner <strong>HitTest</strong>-Funktion müsste es auch gehen:</p>
<p>Probier' mal<br />
[cpp]<br />
if((hPermanent != NULL) &amp;&amp; (uFlags &amp; (TVHT_ONITEM <strong>| TVHT_ONITEMSTATEICON</strong>)))[/cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/555053</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555053</guid><dc:creator><![CDATA[Uwe Philipps]]></dc:creator><pubDate>Wed, 07 Jul 2004 09:41:33 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Wed, 07 Jul 2004 09:52:36 GMT]]></title><description><![CDATA[<p>MMMhhhhhh,</p>
<p>danke Dir, aber leider kein Unterschied.<br />
Er springt immer in die IF anweisung, egal wo ich drauf klicke....</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/555063</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555063</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Wed, 07 Jul 2004 09:52:36 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Wed, 07 Jul 2004 10:30:23 GMT]]></title><description><![CDATA[<p>naja, evtl sind die koordinaten nicht so ganz optimal</p>
<p>machmal in deine treectrl klasse nen onLDown</p>
<p>bei mir gehts so nämlich ganz gut</p>
]]></description><link>https://www.c-plusplus.net/forum/post/555104</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555104</guid><dc:creator><![CDATA[0rp]]></dc:creator><pubDate>Wed, 07 Jul 2004 10:30:23 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Wed, 07 Jul 2004 12:15:02 GMT]]></title><description><![CDATA[<p>Sorry mein Fehler!</p>
<p>Der Abschnitt</p>
<pre><code class="language-cpp">uFlags &amp; (TVHT_ONITEM | TVHT_ONITEMSTATEICON)
</code></pre>
<p>fragt, nur ab, ob eines der beiden Flags gesetzt ist,<br />
wir sind aber an beiden interessiert, also:</p>
<pre><code class="language-cpp">UINT checkflags = TVHT_ONITEM | TVHT_ONITEMSTATEICON;

if((hPermanent != NULL) &amp;&amp; ((TVHT_ONITEM &amp; checkflags) == checkflags))
...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/555175</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555175</guid><dc:creator><![CDATA[Uwe Philipps]]></dc:creator><pubDate>Wed, 07 Jul 2004 12:15:02 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Wed, 07 Jul 2004 12:27:16 GMT]]></title><description><![CDATA[<p>Vielen Dank....</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/555183</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555183</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Wed, 07 Jul 2004 12:27:16 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Thu, 08 Jul 2004 10:05:57 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>jetzt habe ich aber noch einmal eine Frage,</p>
<p>wie oben beschrieben funkt das ganz ziemlich gut.</p>
<p>Jetzt habe ich alledings unter einem Item immer die selbe Struktur.</p>
<p>Item1<br />
|_Alles<br />
|_Gruppen<br />
Item2<br />
|_Alles<br />
|_Gruppen</p>
<p>Jetzt muß ich natürlich wissen, ob er auf alles Item1 oder Item2 gedrückt hat.</p>
<p>Mit meiner Funktion krige ich nur immer beide...</p>
<pre><code class="language-cpp">// In der .h

std::vector&lt;HTREEITEM&gt; m_hItem;
std::vector&lt;HTREEITEM&gt; m_hItemAlles;
std::vector&lt;HTREEITEM&gt; m_hItemGruppe;

void CStatistik::OnNMClickTree(NMHDR *pNMHDR, LRESULT *pResult)
{
	// TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein.

	DWORD dw = GetMessagePos();                   // retrieve mouse cursor position when msg was sent
	CPoint p(GET_X_LPARAM(dw), GET_Y_LPARAM(dw)); // ..and put into point structure
	m_Tree.ScreenToClient(&amp;p);                    // make coords local to tree client area

	UINT htFlags = 0;
	HTREEITEM it = m_Tree.HitTest(p, &amp;htFlags);   // See where the click was on

	if (it != NULL &amp;&amp; ( htFlags &amp; TVHT_ONITEMSTATEICON))
	{  
		for(unsigned i = 0; i &lt; m_hItem.size(); i++)
		{
			if(m_Tree.GetItemText(it) == m_Tree.GetItemText(m_hItem[i]))
			{
                               // macht was.....
			}
			if(m_Tree.GetItemText(it) == m_Tree.GetItemText(m_hItemAlles[i]))
			{
                               // macht was.....
			}
			if(m_Tree.GetItemText(it) == m_Tree.GetItemText(m_hItemGruppe[i]))
			{
                               // macht was.....
			}
		}
	}

	*pResult = 0;
}
</code></pre>
<p>Kann mir da jemand weiter Helfen ??<br />
Ich weiß zwar warum er immer auf beide reagiert, finde aber keine Lösung.</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/555865</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/555865</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Thu, 08 Jul 2004 10:05:57 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Thu, 08 Jul 2004 17:58:33 GMT]]></title><description><![CDATA[<p>Ich glaub das hier könnte dir weiterhelfen:<br />
<a href="http://www.cherea.de/bitbucket/checktree/checktree.html" rel="nofollow">http://www.cherea.de/bitbucket/checktree/checktree.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/556340</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/556340</guid><dc:creator><![CDATA[peterchen]]></dc:creator><pubDate>Thu, 08 Jul 2004 17:58:33 GMT</pubDate></item><item><title><![CDATA[Reply to Checkbox im CTreeView on Fri, 09 Jul 2004 06:20:40 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>vielen Dank, für eure Tips, die Seite kannte ich schon, habe auch ein paar Sachen daraus nehmen können.</p>
<p>Habs zwar nicht ganz so hin bekommen wie ich wollte, funktionieren tut es aber.</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/556523</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/556523</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Fri, 09 Jul 2004 06:20:40 GMT</pubDate></item></channel></rss>