Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Can't use EditItem method of CXTEditListBox class
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Can't use EditItem method of CXTEditListBox class

 Post Reply Post Reply
Author
Message
Michaelw View Drop Down
Newbie
Newbie


Joined: 02 November 2006
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michaelw Quote  Post ReplyReply Direct Link To This Post Topic: Can't use EditItem method of CXTEditListBox class
    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);
    }
}
Back to Top
Michaelw View Drop Down
Newbie
Newbie


Joined: 02 November 2006
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michaelw Quote  Post ReplyReply Direct Link To This Post Posted: 09 November 2006 at 3:33pm
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.
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.172 seconds.