![]() |
CXTEditListBox And user Data |
Post Reply
|
| Author | |
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Topic: CXTEditListBox And user DataPosted: 04 April 2007 at 3:08am |
|
Hello,
I use CXTEditListBox and in the ItemData i store a pointer to a struct. i've subclass CXTEditListBox in ON_WM_DELETEITEM_REFLECT() DeleteItem() i delete the struct. But if i rename a item, the OnEndLabelEdit function call DWORD_PTR dwData = GetItemData(m_nIndex); DeleteString(m_nIndex); InsertString(m_nIndex, m_strItemText); SetItemData(m_nIndex, dwData); But now in DeleteString the dwData will be destroy. But SetItemData put the deleted Item pointer into the List. Any solution to solve this problem ? Jimmy |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 04 April 2007 at 5:08am |
|
Hi,
I think you need move this code from DELETEITEM_REFLECT to some OnDestroy.
Same DeleteString/InsertString used a lot in code - in OnMoveItemUp/OnMoveItemDown/OnItemBrowse etc.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Posted: 05 April 2007 at 8:00am |
|
Is it not easyer to swap item text and item data, instead of delete insert ?
Jimmy |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 April 2007 at 8:43am |
|
Hi,
It sounds weird, but in Windows API there is no way to set text for existed listbox item.
btw, check CustomizeDlg sample. It used
ON_LBN_XT_PREDELETEITEM(IDC_LBOX_TOOLSLIST, OnPreDeleteItem)
to delete items.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
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 |