dvenkat
asked on
programmatically enable EDITLABLES in listControl
1) I want to programmatically enable editing of current SELECTED/FOCUSED list item (in CListCntrl). How to do it (with input focus)?
2) How to enable editing of a specific column within a row (in multi-column list control)?
-----
For example in AppWizrd when you create a list control (in a dialog) you can set a property flag ("Edit lable" check box) in property page.
I want to do it at run time programmatically. I tried the following, but is not working:
Failed method 1:
-------------------------
//begin in-place editing of the newly inserted row
CEdit * pEdit = m_ListCtrl.EditLabel( m_ListCtrl.GetItemCount( ) );
if (NULL != pEdit )
pEdit->SetFocus();
Failed method 2:
-------------------------- ----
//Insert items
LV_ITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_STATE;
lvi.iItem = m_ListCtrl.GetItemCount( );
lvi.iSubItem = 0;
lvi.iImage = 0;
lvi.stateMask = LVIS_CUT | LVIS_DROPHILITED | LVIS_FOCUSED | LVIS_SELECTED | LVS_EDITLABELS | LVS_SHOWSELALWAYS ;
lvi.state = LVIS_FOCUSED | LVIS_SELECTED ;
lvi.pszText = "";
//insert this item now! m_ListCtrl.InsertItem(&lvi );
//make this new item selected/in-focus
m_ListCtrl.SetItemState(m_ ListCtrl.G etItemCoun t( ), LVIS_FOCUSED | LVIS_SELECTED, LVIS_SELECTED);
UpdateData(FALSE);
//send begin lable edit message
m_ListCtrl.PostMessage(WM_ NOTIFY, IDC_LISTCTRL, (LPARAM)&msgHdr);
//or this line!!!!!!!!!!!!!!!! (alternatively) ::SendMessage(m_ListEmailU serNames.G etSafeHwnd (), LVN_BEGINLABELEDIT, IDC_LISTCTRL, (LPARAM)&lvi);
2) How to enable editing of a specific column within a row (in multi-column list control)?
-----
For example in AppWizrd when you create a list control (in a dialog) you can set a property flag ("Edit lable" check box) in property page.
I want to do it at run time programmatically. I tried the following, but is not working:
Failed method 1:
-------------------------
//begin in-place editing of the newly inserted row
CEdit * pEdit = m_ListCtrl.EditLabel( m_ListCtrl.GetItemCount( ) );
if (NULL != pEdit )
pEdit->SetFocus();
Failed method 2:
--------------------------
//Insert items
LV_ITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_STATE;
lvi.iItem = m_ListCtrl.GetItemCount( );
lvi.iSubItem = 0;
lvi.iImage = 0;
lvi.stateMask = LVIS_CUT | LVIS_DROPHILITED | LVIS_FOCUSED | LVIS_SELECTED | LVS_EDITLABELS | LVS_SHOWSELALWAYS ;
lvi.state = LVIS_FOCUSED | LVIS_SELECTED ;
lvi.pszText = "";
//insert this item now! m_ListCtrl.InsertItem(&lvi
//make this new item selected/in-focus
m_ListCtrl.SetItemState(m_
UpdateData(FALSE);
//send begin lable edit message
m_ListCtrl.PostMessage(WM_
//or this line!!!!!!!!!!!!!!!! (alternatively) ::SendMessage(m_ListEmailU
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER