Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - BUG: GetFocusedRow() returns row 0 if no selection
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

BUG: GetFocusedRow() returns row 0 if no selection

 Post Reply Post Reply
Author
Message
Michl View Drop Down
Senior Member
Senior Member


Joined: 14 September 2007
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michl Quote  Post ReplyReply Direct Link To This Post Topic: BUG: GetFocusedRow() returns row 0 if no selection
    Posted: 20 March 2008 at 10:33am
Hello
 
After showing the report, no row should be selected.
 
I tried the solution to call
1) GetSelectedRows()->Clear() after Populate() and to call
2) SelectionEnable(FALSE) before Populate() and reactivate it after Populate().
Both works.
 
But in our update code we store the last selected record to restore selection after refill. If the user has not yet selects a row, GetFocusedRow() returns although the first row.
 
I found the problem in Populate();

 if (m_nFocusedRow == -1)
 {
  SetTopRow(0);
  if (GetRows()->GetCount() > 0)
  {
   m_nFocusedRow = 0;
   if(IsSelectionEnabled())
    m_pSelectedRows->Select(m_pRows->GetAt(0));
  }
 }
 
I think it should be looks like so:

 if (m_nFocusedRow == -1)
 {
  SetTopRow(0);
  if (GetRows()->GetCount() > 0)
  {
   if(IsSelectionEnabled())
   {
    m_nFocusedRow = -1;
    if(IsSelectionEnabled())
     m_pSelectedRows->Select(m_pRows->GetAt(0));  
  }
 }
 
But in this case only solution (2) works.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.