Print Page | Close Window

InitialSelectionEnable not working

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=13417
Printed Date: 06 May 2024 at 1:56am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: InitialSelectionEnable not working
Posted By: adrien
Subject: InitialSelectionEnable not working
Date Posted: 15 February 2009 at 11:50pm
Hi

I am setting InitialSelectionEnable(FALSE) on my report control.

however if there is nothing selected, and I click in a column header to sort, it selects a random row all by itself, and doesn't send any notification.

Adrien

-------------
http://www.wingate.com - http://www.wingate.com



Replies:
Posted By: adrien
Date Posted: 16 February 2009 at 12:05am
I hacked the report control to fix it.

void CXTPReportControl::ReSortRows()
{
     if (IsVirtualMode())
     {
          Populate();
          return;
     }

     // are there any selected rows?
     BOOL bRowsSelected = GetSelectedRows()->GetCount() != 0;

     SortTree(m_pPlainTree);

     CXTPReportRecord* pFocusedRecord = GetFocusedRow() ? GetFocusedRow()->GetRecord() : NULL;

     m_pRows->Clear();
     m_arrScreenRows.Clear(FALSE);

     for (int nGroupRow = 0; nGroupRow < m_pPlainTree->GetCount(); nGroupRow++)
     {
          CXTPReportRow* pRow = m_pPlainTree->GetAt(nGroupRow);
          InsertRow(m_pRows->GetCount(), pRow);
          pRow->m_nChildIndex = nGroupRow;
          ASSERT(pRow->m_pParentRows == m_pPlainTree);
     }

     //-----------------------------------------------------------------------
     m_nFocusedRow = -1;
     // Update indexes on virtual rows
     int nRowCount = m_pRows->GetCount();
     for (int nRowIndex = 0; nRowIndex < nRowCount; nRowIndex++)
     {
          CXTPReportRow* pRow = m_pRows->GetAt(nRowIndex);
          if (pRow)
          {
               pRow->SetIndex(nRowIndex);
               pRow->m_bVisible = TRUE;

               if (pFocusedRecord && pRow->GetRecord() == pFocusedRecord)
               {
                    m_nFocusedRow = pRow->GetIndex();
                    if (IsSelectionEnabled() && bRowsSelected)
                         m_pSelectedRows->Select(pRow);
               }
          }
     }

     AdjustIndentation();
     AdjustLayout();

     RedrawControl();
}



-------------
http://www.wingate.com - http://www.wingate.com


Posted By: mdoubson
Date Posted: 16 February 2009 at 1:03am

Good - I check you contribution and with small modifications use it in our source (Release 13.1). Thanks.

void CXTPReportControl::ReSortRows()
{
   
....... 

   BOOL bRowsSelected = m_bInitialSelectionEnable;

   if (GetSelectedRows()!= NULL)
   {
      if (GetSelectedRows()->GetCount() > 0)
         bRowsSelected = TRUE;
   }

   .......
}


-------------
Mark Doubson, Ph.D.



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