Delete Selected |
Post Reply |
Author | |
eam74
Groupie Joined: 18 June 2014 Location: USA Status: Offline Points: 15 |
Post Options
Thanks(0)
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
|
|
eam74
Groupie Joined: 18 June 2014 Location: USA Status: Offline Points: 15 |
Post Options
Thanks(0)
|
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
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
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! |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |