Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Delete Selected
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Delete Selected

 Post Reply Post Reply
Author
Message
eam74 View Drop Down
Groupie
Groupie
Avatar

Joined: 18 June 2014
Location: USA
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote eam74 Quote  Post ReplyReply Direct Link To This Post Topic: Delete Selected
    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
Back to Top
eam74 View Drop Down
Groupie
Groupie
Avatar

Joined: 18 June 2014
Location: USA
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote eam74 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post 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!
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.