SFS
asked on
edit CListCtrl
HI,everybody:
I have a simple program regarding listview.
I have already set the style of my listview to LVS_EDITLABELS and I also add message handler like this:
void CMyListCtrl::OnEndLabelEdi t(NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = TRUE;
}
But after I edit the first column lable,the change aint be saved,it retains as original.
Why?
I debug and I find the above message handler never be reached .
Please help me,it's very urgent.
Thanks
I have a simple program regarding listview.
I have already set the style of my listview to LVS_EDITLABELS and I also add message handler like this:
void CMyListCtrl::OnEndLabelEdi
{
*pResult = TRUE;
}
But after I edit the first column lable,the change aint be saved,it retains as original.
Why?
I debug and I find the above message handler never be reached .
Please help me,it's very urgent.
Thanks
ASKER
I only try to edit it the the first conlumn of items, I just do experiment from codeguru.
Now I can let the edit box pop up to edit but the problem is after I finish it,the text in the first column back to original text.
I add end... message handler in my clistctrl but it never be reached.
Thanx alot, VinExpert
SFS
Now I can let the edit box pop up to edit but the problem is after I finish it,the text in the first column back to original text.
I add end... message handler in my clistctrl but it never be reached.
Thanx alot, VinExpert
SFS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Sorry for the spell mistakes. Give me Ur email ID, I will send the sample workspace to u.
Cheers,
VinExpert
Sorry for the spell mistakes. Give me Ur email ID, I will send the sample workspace to u.
Cheers,
VinExpert
No need to use cannon to kill an ant. Try this out:
void CMyListCtrl::OnEndLabelEdi t(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
LVITEM lvi;
m_listctrl.GetItem(&lvi);
lvi.pszText = pDispInfo->item.pszText;
m_listctrl.SetItem(&lvi);
*pResult = TRUE;
}
void CMyListCtrl::OnEndLabelEdi
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
LVITEM lvi;
m_listctrl.GetItem(&lvi);
lvi.pszText = pDispInfo->item.pszText;
m_listctrl.SetItem(&lvi);
*pResult = TRUE;
}
If you want to edit subitems, then think about creating an edit control.
ASKER
NO,my dear friends.YOu misunderstand me totally!!
Maybe I didnt make it clear,as I said ,I dont wanna edit the subitem but the first column item,SO it'n unnecessary for me to create an edit box and it should be very easy.
Now my problem is I add the style in resource workplace and I add message handler for endedititem in Cmylistctrl but it seems the handler never be reached,if I add the handler in the dialoge,it be reached,why?
THe other problem is the change never be retained.HOw to?
Thanks
To vinexpert:
thank you and if you 'd like to mail it to me for info,please send the code to
geeboy@163.net
Thanx.
Maybe I didnt make it clear,as I said ,I dont wanna edit the subitem but the first column item,SO it'n unnecessary for me to create an edit box and it should be very easy.
Now my problem is I add the style in resource workplace and I add message handler for endedititem in Cmylistctrl but it seems the handler never be reached,if I add the handler in the dialoge,it be reached,why?
THe other problem is the change never be retained.HOw to?
Thanks
To vinexpert:
thank you and if you 'd like to mail it to me for info,please send the code to
geeboy@163.net
Thanx.
Hi,
I have sent u the sample workspace.
Try it out.
VinExpert
I have sent u the sample workspace.
Try it out.
VinExpert
>Now my problem is I add the style in resource workplace and I add message handler for endedititem in Cmylistctrl but it seems the handler never be reached,if I add the handler in the dialoge,it be reached,why?
It should reach in your derived list control also.
>The other problem is the change never be retained.HOw to?
To retain the changes, *you* have to make changes using either SetItem or SetItemText. You can make changes as I suggested in my last post. Try it out.
Vicky
It should reach in your derived list control also.
>The other problem is the change never be retained.HOw to?
To retain the changes, *you* have to make changes using either SetItem or SetItemText. You can make changes as I suggested in my last post. Try it out.
Vicky
I dont think this question is so easy.
R u trying to edit the column headers? or the items?.
Pls specify.
VinExpert