<pre class="bz_comment_text" id="comment_text_0">Hi.<br><br>BUG:<br>TreeView sends TVS_GETDISPINFO notifycation. Main application catch it and<br>change "mask","state" and "stateMask" in a TVITEM structure. After returning<br>
from message handler, item's state don't changed. TreeView don't save new item<br>state in function TREEVIEW_UpdateDispInfo after calling<br>TREEVIEW_SendRealNotify.<br><br>This is Delphi code sample, TMyTreeView inherits from TCustomTreeView<br>
//-----------------------------------------------------------------<br>procedure TMyTreeView.CNNotify(var Message: TWMNotify);<br>var<br> hNode: Integer;<br>begin<br> with Message do<br> case NMHdr^.code of<br> TVN_GETDISPINFO:<br>
with PTVDispInfo(NMHdr)^ do begin<br> hNode := item.hItem;<br> with PTVDispInfo(NMHdr)^.item do begin<br> mask := mask or TVIF_STATE or TVIF_HANDLE;<br> stateMask := stateMask or TVIS_STATEIMAGEMASK;<br>
state := (state and not TVIS_STATEIMAGEMASK)<br> or UINT(IndexToStateImageMask(MyGetItemImageIndex(hNode)));<br> end;<br> end;<br> end;<br><br> inherited;<br>end;<br>//-----------------------------------------------------------------<br>
<br>This's link to MSDN page, where described how it must work:<br><a href="http://msdn.microsoft.com/en-us/library/bb773456%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/bb773456(VS.85).aspx</a><br><br>I'm offer this patch (attached) to fix this bug.<br>
</pre>