Print Page | Close Window

Move Up/Down records

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=13641
Printed Date: 29 September 2024 at 9:37pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Move Up/Down records
Posted By: Sudhakar
Subject: Move Up/Down records
Date Posted: 11 March 2009 at 4:25am
I have below code in a button("Move Up" ) handler. I need to move the record whenever the user clicks the "Move Up" button after selecting a report control row. Below code is not moving the record up. The focus(selection) just moving up, but the data of the selected record is not moving up. What could be the problem? Please suggest.
 

void CPVRuleManagerDlg::OnBnClickedMoveup()
{
  CXTPReportRow *pSelRow = m_wndReportCtrl.GetFocusedRow();
  if( pSelRow != NULL )
  {
    int index = pSelRow->GetIndex();
    CXTPReportRow *pRow = m_wndReportCtrl.GetRows()->GetAt(index);
    if(pRow)
    {
      pRow->InternalAddRef();
      m_wndReportCtrl.GetRows()->RemoveAt(index);
      m_wndReportCtrl.GetRows()->InsertAt(index-1,pRow);
      m_wndReportCtrl.RedrawControl();
      m_wndReportCtrl.SetFocus();
    }
  }
  m_wndReportCtrl.Populate();
}




Replies:
Posted By: Sudhakar
Date Posted: 14 March 2009 at 11:21am

Somehow I got the solution. It works with CXTPReportRecord instead of CXTPReportRow.

 void CPVRuleManagerDlg::OnBnClickedMoveup()
 {
  CXTPReportRow *pSelRow = m_wndReportCtrl.GetFocusedRow();
  if( pSelRow != NULL )
  {
    int index = pSelRow->GetIndex();

    if( index== 0)
      return;

    CXTPReportRecord *pRecord = m_wndReportCtrl.GetRecords()->GetAt(index);
    if(pRecord)
    {
      pRecord->InternalAddRef();
      m_wndReportCtrl.GetRecords()->RemoveAt(index);
      m_wndReportCtrl.GetRecords()->InsertAt(index-1,pRecord);

      m_wndReportCtrl.Populate();
      m_wndReportCtrl.SetFocus();
    }
  }
}



Posted By: znakeeye
Date Posted: 19 March 2009 at 7:30am
Perhaps you should read this thread: http://forum.codejock.com/forum_posts.asp?TID=13113 - http://forum.codejock.com/forum_posts.asp?TID=13113

-------------
PokerMemento - http://www.pokermemento.com/



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