CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Threaded View

  1. #1
    Join Date
    May 2002
    Posts
    1,798

    old problem with CListCtrl::EditLabel

    I have looked over many posts and articles on this problem without being able to solve it. I have a CListCtrl created with the following styles:
    Code:
    	DWORD dwListStyle = LVS_REPORT | LVS_SORTASCENDING | LVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | LVS_EDITLABELS ;
    When I attempt to edit an entry, it appears to edit just fine, but when I hit return following the edit, the former label reappears.

    I have attempted to follow the advice posted by others indicating the need for 'handling' LVN_BEGINLABELEDIT and LVN_ENDLABELEDIT.

    http://www.codeguru.com/forum/showth...trl+edit+label

    http://www.codeguru.com/Cpp/controls...icle.php/c897/

    My attempts to do this look like this:
    Code:
    // in class header
    //..
    	CListCtrl m_MyListCtrl;
    //..
    
    // in class implementation
    // void MyClass::Rename()
    {
    //..
    	int nItem;
    	nItem = m_MyListCtrl.GetNextItem(-1, LVNI_SELECTED);
    
    //..
    	m_MyListCtrl.SendMessage(LVN_BEGINLABELEDIT, 0, 0);
    	m_MyListCtrl.EditLabel(nItem);  // how to make edit permanent ?
    	m_MyListCtrl.SendMessage(LVN_ENDLABELEDIT, 0, 0);
    //..
    There are no errors encountered. The label appears to edit properly, but when leaving the item, the old label reappears.

    Please help.
    Last edited by Mike Pliam; December 24th, 2011 at 03:47 AM.
    mpliam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured