<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Still not fixed</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Report Control : Still not fixed]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sun, 19 Apr 2026 02:08:01 +0000</pubDate>
  <lastBuildDate>Wed, 24 Mar 2010 04:06:48 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=16501</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Still not fixed : Hello Codejock-Team!Please load...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16501&amp;PID=57757&amp;title=still-not-fixed#57757</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3301">Michl</a><br /><strong>Subject:</strong> 16501<br /><strong>Posted:</strong> 24 March 2010 at 4:06am<br /><br />Hello Codejock-Team!<br><br>Please load your sample application "ReportSample" and add this code:<br><table width="99%"><tr><td><pre class="BBcode"><br>void CReportSampleView::OnReportKeyDown(NMHDR * pNotifyStruct, LRESULT * /*result*/)<br>{<br>&nbsp;&nbsp;&nbsp; LPNMKEY lpNMKey = (LPNMKEY)pNotifyStruct;<br><br>&nbsp;&nbsp;&nbsp; if (!GetReportCtrl().GetFocusedRow())<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return;<br><br>&nbsp;&nbsp;&nbsp; if (lpNMKey-&gt;nVKey == VK_RETURN)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CMessageRecord* pRecord = DYNAMIC_DOWNCAST(CMessageRecord, GetReportCtrl().GetFocusedRow()-&gt;GetRecord());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pRecord)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pRecord-&gt;SetRead())<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GetReportCtrl().Populate();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br><font color="#ff0000">&nbsp;&nbsp;&nbsp; else if (lpNMKey-&gt;nVKey == VK_DELETE)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CMessageRecord* pRecord = DYNAMIC_DOWNCAST(CMessageRecord, GetReportCtrl().GetFocusedRow()-&gt;GetRecord());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!pRecord)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AfxMessageBox( _T("Can't remove record!"), MB_OK);<br>&nbsp;&nbsp;&nbsp; }<br></font>}<br></pre></td></tr></table><br><br>Compile and run application.<br>If application is showing press immediatelly &#091;DEL&#093; to remove (as sample action) first selected record.<br><br>It is not possible!<br>The reason ist that Populate() select every time internally row 0 as active selection! (in this case the group row)<br>But this don't works if groups are displaying.<br><table width="99%"><tr><td><pre class="BBcode"><br>&nbsp;&nbsp;&nbsp; if (m_nFocusedRow == -1)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SetTopRow(0);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (GetRows()-&gt;GetCount() &gt; 0)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <font color="#ff0000">m_nFocusedRow = 0;</font><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (IsSelectionEnabled() &amp;&amp; IsInitialSelectionEnabled())<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CXTPReportRow* pFirst = m_pRows-&gt;GetAt(0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pFirst)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!IsSkipGroupsFocusEnabled() || !pFirst-&gt;IsGroupRow())<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_pSelectedRows-&gt;Select(pFirst);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while (pFirst-&gt;IsGroupRow())<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pFirst-&gt;HasChildren())<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pFirst = pFirst-&gt;GetChilds()-&gt;GetAt(0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_pSelectedRows-&gt;Select(pFirst);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; EnsureVisible(GetFocusedRow());<br>&nbsp;&nbsp;&nbsp; }<br></pre></td></tr></table><br><br><br>I see you have extend OnRButtonDown() with SetFocusedRow(). This solves the problem only for mouse inputs.<br><table width="99%"><tr><td><pre class="BBcode"><br>void CXTPReportControl::OnRButtonDown(UINT nFlags, CPoint point)<br>{<br>&nbsp;&nbsp;&nbsp; CWnd::OnRButtonDown(nFlags, point);<br><br>&nbsp;<font color="#ff0000">&nbsp;&nbsp; CXTPReportRow* pRow = HitTest(point, TRUE);<br>&nbsp;&nbsp;&nbsp; if (pRow)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <b>SetFocusedRow(pRow, pRow-&gt;IsSelected());</b><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_pointDrag = point;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (m_bRClickDrag) m_bPrepareDrag = TRUE;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; else if (m_bFastDeselectMode)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; BOOL bControlKey = (GetKeyState(VK_CONTROL) &lt; 0) || m_bControlKeyAlwaysOn;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; BOOL bShiftKey = (GetKeyState(VK_SHIFT) &lt; 0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!bControlKey &amp;&amp; !bShiftKey)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_pSelectedRows-&gt;Clear();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (m_pSelectedRows-&gt;IsChanged())<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; OnSelectionChanged();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }</font><br>}<br></pre></td></tr></table><br><br>See also my postings:<br><a href="http://forum.codejock.com/forum_posts.asp?TID=9932&amp;PN=1" target="_blank">http://forum.codejock.com/forum_posts.asp?TID=9932&amp;PN=1</a><br><a href="http://forum.codejock.com/forum_posts.asp?TID=10539&amp;KW=" target="_blank">http://forum.codejock.com/forum_posts.asp?TID=10539&amp;KW=</a><br><br><br>]]>
   </description>
   <pubDate>Wed, 24 Mar 2010 04:06:48 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16501&amp;PID=57757&amp;title=still-not-fixed#57757</guid>
  </item> 
 </channel>
</rss>