please help with my attempt to edit subitem of CListCtrl
-
I'm trying to edit subitem of a CListCtrl object. Here's what I do: void CMyDialog::OnBeginLabelEditMyListCtrl(NMHDR* pNMHDR, LRESULT *pResult) { // based on current mouse position, find out which item and // iSubItem are being clicked by using m_myListCtrl.SubItemHitTest(&ht) // get the rect of the licked sub item by // m_myListCtrl.getSubItemRect(ht.iItem, ht.iSubItem, LVIR_LABEL, subRect); // try to put my variable CEdit m_edit at this location CEdit *plistEdit = m_myListCtrl.GetEditControl(); if ( plistEdit ) { m_edit.SubClassWindow(plistEdit->m_hWnd); <--- ERROR here } // coding to set *pResult } when running, the error message is: Error: Trying to use SubclassWindow with incorrect CWnd derived class. hWnd = $608D8 (nIDC=$0000) is not a CEdit. how come? both plistEdit and m_edit are of CEdit, why this error? Thanks for any help!
-
I'm trying to edit subitem of a CListCtrl object. Here's what I do: void CMyDialog::OnBeginLabelEditMyListCtrl(NMHDR* pNMHDR, LRESULT *pResult) { // based on current mouse position, find out which item and // iSubItem are being clicked by using m_myListCtrl.SubItemHitTest(&ht) // get the rect of the licked sub item by // m_myListCtrl.getSubItemRect(ht.iItem, ht.iSubItem, LVIR_LABEL, subRect); // try to put my variable CEdit m_edit at this location CEdit *plistEdit = m_myListCtrl.GetEditControl(); if ( plistEdit ) { m_edit.SubClassWindow(plistEdit->m_hWnd); <--- ERROR here } // coding to set *pResult } when running, the error message is: Error: Trying to use SubclassWindow with incorrect CWnd derived class. hWnd = $608D8 (nIDC=$0000) is not a CEdit. how come? both plistEdit and m_edit are of CEdit, why this error? Thanks for any help!
-
I'm trying to edit subitem of a CListCtrl object. Here's what I do: void CMyDialog::OnBeginLabelEditMyListCtrl(NMHDR* pNMHDR, LRESULT *pResult) { // based on current mouse position, find out which item and // iSubItem are being clicked by using m_myListCtrl.SubItemHitTest(&ht) // get the rect of the licked sub item by // m_myListCtrl.getSubItemRect(ht.iItem, ht.iSubItem, LVIR_LABEL, subRect); // try to put my variable CEdit m_edit at this location CEdit *plistEdit = m_myListCtrl.GetEditControl(); if ( plistEdit ) { m_edit.SubClassWindow(plistEdit->m_hWnd); <--- ERROR here } // coding to set *pResult } when running, the error message is: Error: Trying to use SubclassWindow with incorrect CWnd derived class. hWnd = $608D8 (nIDC=$0000) is not a CEdit. how come? both plistEdit and m_edit are of CEdit, why this error? Thanks for any help!
What is the value of m_edit::m_hWnd before the call to m_edit.SubclassWindow()? m_edit is not allowed to have an window already attached to it before calling SubclassWindow. Look up CWnd::SubclassWindow in MSDN for more information.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!
Honoured as one of The Most Helpful Members of 2004
-
What is the value of m_edit::m_hWnd before the call to m_edit.SubclassWindow()? m_edit is not allowed to have an window already attached to it before calling SubclassWindow. Look up CWnd::SubclassWindow in MSDN for more information.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!
Honoured as one of The Most Helpful Members of 2004