Print Page | Close Window

Delete Selected

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=22338
Printed Date: 16 June 2025 at 5:27pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Delete Selected
Posted By: eam74
Subject: Delete Selected
Date Posted: 25 June 2014 at 3:31pm
I am trying to implement a "delete column" function for my report control.  The function works perfectly for all cases EXCEPT when the user has selected the last column and is trying to delete it, then it will crash.  A selected column in the middle is fine, and deleting the last column when it is not selected is fine.  After testing, I believe the reason for the crash is because something is using the selected column / index which no longer exists, but I am unable to find where this is happening.  Any pointers would be greatly appreciated!

TIA


-------------
Xtreme ToolkitPro (C++) v16.1.0, Windows 7



Replies:
Posted By: eam74
Date Posted: 25 June 2014 at 4:06pm
Ok, I can get it to work with a couple changes -

1. Reset the column focus after calling Populate(), as such: reportControl.SetFocusedColumn(reportControl.GetColumns()->GetAt(0));

2. I am using a custom paint manager which paints the current column differently, so reset that variable as well: paintMgr->m_curColumn = 0;

Hopefully someone else finds this useful!


-------------
Xtreme ToolkitPro (C++) v16.1.0, Windows 7


Posted By: Algae
Date Posted: 15 March 2016 at 1:16pm
Hi Eam74,

How did you make a "Delete Column" method?

I tried doing this some time ago and had trouble with the following:

1. Column delete. "Remove Column" doesn't seem to perform a delete.  Somehow, the column is retained. I have no idea why that is.

wndReport.GetColumns()->Remove(pColumn);

2. Column indexing. Removing a column doesn't delete existing Record Items. When I made a "Delete Item" method to accommodate this the column indexing remains and record items won't be in the right column.

3. Item delete. There doesn't seem to be a method to delete a Record item except for a method to delete all Record items in the CJ library. The following appears to work, but the column indexing is off.

// my attempt at Item delete

    void DeleteItem(CXTPReportRecordItem* pItem)
    {
        int nIndex = IndexOf(pItem);
        if (nIndex != -1)
        {
            m_arrItems.RemoveAt(nIndex);
            pItem->InternalRelease();
        }
    }

Could you give me an idea how you handle these things or a hint at where I've gone wrong? It would be appreciated.

Thanks!



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