Print Page | Close Window

Undesired CXTEditListBox behavior

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=7303
Printed Date: 16 May 2024 at 6:59pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Undesired CXTEditListBox behavior
Posted By: znakeeye
Subject: Undesired CXTEditListBox behavior
Date 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



Replies:
Posted By: Oleg
Date Posted: 06 June 2007 at 1:32am
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


Posted By: znakeeye
Date Posted: 11 June 2007 at 6:54am

Hi,

Sorry, but EditListItem() is not virtual. I had to implement these functions to get the desired behavior:
 
OnEndLabelEdit()
OnNewItem()
OnDeleteItem()
OnMoveItemUp()
OnMoveItemDown()


Posted By: znakeeye
Date Posted: 11 June 2007 at 9:04am
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 :(



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