Can't use EditItem method of CXTEditListBox class |
Post Reply |
Author | |
Michaelw
Newbie Joined: 02 November 2006 Status: Offline Points: 3 |
Post Options
Thanks(0)
Posted: 02 November 2006 at 3:21pm |
I am using CXTEditListBox to edit a list of items. There is a need to prevent duplicate entry in the list. So I maped the ON_LBN_XT_LABELEDITEND message. Inside the message handle function, I check the text of current edit item. If the same item already exist. I try to force the user to edit the current item again. I use void CXTEditListBox.EditItem(int iItem) to edit the item. However, the item selected doesn't entry a edit state. I tried to put EnableEdit() in front of it . Still not working. Does anyone know how to solve this problem?
Thanks, ON_LBN_XT_LABELEDITEND(IDC_LIST_FRAMEWORK, OnLabelEditEnd) void CMyDlg::OnLabelEditEnd() { int nSel = m_lstFramework.GetCurrentIndex(); if( nSel == LB_ERR ) return; CString strText; m_lstFramework.GetText(nSel, strText); strText.Trim(); if( IsNameDuplicated(strText, nSel) ) { //show a message. ... //this doesn't work. m_lstFramework.EditItem(nSel); } } |
|
Michaelw
Newbie Joined: 02 November 2006 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
I figure out the problem is caused by calling EditItem() function inside a list box message handler. If I call it from other place, it works. So I post a user message to the dialog that host this control. Inside the user message handler. I call the EditItem() function. Problem solved.
|
|
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 |