void CArgumentsTableCtrl::OnLButtonDblClk(UINT nFlags, CPoint point) //void CArgumentsTableCtrl::OnLButtonDown(UINT nFlags, CPoint point) { int index; CListCtrl::OnLButtonDown(nFlags, point); int colnum; if((index = HitTestEx(point, &colnum)) != -1){ UINT flag = LVIS_FOCUSED; if((GetItemState( index, flag ) & flag) == flag) { // Add check for LVS_EDITLABELS if(GetWindowLong(m_hWnd, GWL_STYLE) & LVS_EDITLABELS) { LV_DISPINFO dispinfo; dispinfo.hdr.hwndFrom = this->GetSafeHwnd(); dispinfo.hdr.idFrom = GetDlgCtrlID(); dispinfo.hdr.code = LVN_BEGINLABELEDIT; dispinfo.item.iItem = index; // Send message to the parent that we are ready to edit. SendMessage( WM_NOTIFY, GetDlgCtrlID(),(LPARAM)&dispinfo); EditSubLabel(index, colnum); } } else SetItemState(index, LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED); } }
// ************************************************************************** // OnNextSubLabel () // // Description: // On Down Arrow message handler. // // Parameters: // WPARAM wParam Not used. // LPARAM lParam Not used. // // Returns: // long - 0. // ************************************************************************** long CKListEditCtrl::OnNextSubLabel (WPARAM wParam, LPARAM lParam) { // Next item: ++m_nSelItem; // Wrap to start if next is invalid: if (m_nSelItem >= GetItemCount ()) m_nSelItem = 0; // Edit new item: EditSubLabel (m_nSelItem, 2); return (0); }
// ************************************************************************** // OnPrevSubLabel () // // Description: // On Up Arrow message handler. // // Parameters: // WPARAM wParam Not used. // LPARAM lParam Not used. // // Returns: // long - 0. // ************************************************************************** long CKListEditCtrl::OnPrevSubLabel (WPARAM wParam, LPARAM lParam) { // Previous item: --m_nSelItem; // Wrap to end if previous is invalid: if (m_nSelItem < 0) m_nSelItem = GetItemCount () - 1; // Edit new item: EditSubLabel (m_nSelItem, 2); return (0); }
// ************************************************************************** // OnLButtonDown () // // Description: // Left mouse button down event handler. // // Parameters: // UINT nFlags Flags. // CPoint cPoint Current location of mouse cursor. // // Returns: // void // ************************************************************************** void CKListEditCtrl::OnLButtonDown (UINT nFlags, CPoint cPoint) { int nIndex; int nCol; // Perform default processing: CListCtrl::OnLButtonDown (nFlags, cPoint); // Determine which item (i.e, row was hit): if ((nIndex = HitTestEx (cPoint, &nCol)) != -1) { // If the item column clicked on is editable, display an edit control: if (nCol > 1) // Only last column is editable EditSubLabel (nIndex, nCol); // otherwise select the item: else SetItemState (nIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); } }
void CVarListCtrl::OnLButtonDown(UINT nFlags, CPoint point) { int index; CListCtrl::OnLButtonDown(nFlags, point); int colnum; if( ( index = HitTestEx( point, &colnum )) != -1 ) { UINT flag = LVIS_FOCUSED; if( (GetItemState( index, flag ) & flag) == flag && colnum > 0) { // Add check for LVS_EDITLABELS if( GetWindowLong(m_hWnd, GWL_STYLE) & LVS_EDITLABELS ) EditSubLabel( index, colnum ); } else { SetItemState( index, LVIS_SELECTED | LVIS_FOCUSED , LVIS_SELECTED | LVIS_FOCUSED); } } }