Print Page | Close Window

BUG: GetFocusedRow() returns row 0 if no selection

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=9932
Printed Date: 22 November 2024 at 11:07pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: BUG: GetFocusedRow() returns row 0 if no selection
Posted By: Michl
Subject: BUG: GetFocusedRow() returns row 0 if no selection
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net