Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Undesired CXTEditListBox behavior
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Undesired CXTEditListBox behavior

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: Undesired CXTEditListBox behavior
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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()
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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 :(
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.203 seconds.