Undesired CXTEditListBox behavior |
Post Reply |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Posted: 05 June 2007 at 4:05am |
Hi,
When adding/removing items from a CXTEditListBox you get notifications in the form of LBN_XT_PRENEWITEM/LBN_XT_NEWITEM and LBN_XT_PREDELETEITEM/LBN_XT_DELETEITEM.
Let's say that you want to display a "Yes/No"-messagebox before deleting an item. Then what? There is no way to cancel the action.
Perhaps it would be a good idea to implement "pre"-messages for all actions (move up/down too) and check the return value. If TRUE, then cancel the action, otherwise perform it as usual.
As for a temporary solution, I guess the best would be to override CXTEditListBox::OnDeleteItem() etc?
Thanks!
/Chris
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Problem that now these message implemented as WM_COMMAND - and MFC automatically will return 1 if they was handled.
EditListItem is virtual method, you can override it.
Thanks.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Hi, Sorry, but EditListItem() is not virtual. I had to implement these functions to get the desired behavior:
OnEndLabelEdit()
OnNewItem()
OnDeleteItem()
OnMoveItemUp()
OnMoveItemDown()
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Actually, that didn't work! When pressing <DEL> OnDeleteItem() is called directly, and since it too isn't virtual, my overrided function is not called.
CXTEditListBox::PreTranslateMessage()
... OnDeleteItem();
Argh :(
|
|
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 |