/******************************************************************************* Function Name : OnDoubleClick Description : Event Handler. This handler will show the controls to edit the selected data from the list control. This will call ShowControl function with the item and subitem indices. Member of : CFlexListCtrl Author(s) : Raja N Date Created : 22.07.2004 Modifications : Raja N on 01.08.2004, Modified the function name ShowControl as vShowControl. Modifications : Raja N on 08.07.2005, Modified the function send LVN_BEGINLABELEDIT before showing the UI control. *******************************************************************************/ void CFlexListCtrl::OnDoubleClick(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here if( m_bSingleClickActivate == FALSE ) { // Set the focus to the list control if( GetFocus() != this) { SetFocus(); } // Send Notification to Parent so that Begin Label Edit // Handler will be getting called NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // Send Notification to parent of ListView ctrl LV_DISPINFO lvDispInfo; lvDispInfo.hdr.hwndFrom = m_hWnd; lvDispInfo.hdr.idFrom = GetDlgCtrlID(); lvDispInfo.hdr.code = LVN_BEGINLABELEDIT; lvDispInfo.item.mask = LVIF_TEXT; lvDispInfo.item.iItem = pNMListView->iItem; lvDispInfo.item.iSubItem = pNMListView->iSubItem; lvDispInfo.item.pszText = NULL; lvDispInfo.item.cchTextMax = 0; CWnd * pWnd = GetParent(); if( pWnd != NULL ) { pWnd->SendMessage( WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&lvDispInfo ); } // Call Handler Function with required parameters vShowControl(pNMListView->iItem, pNMListView->iSubItem); } *pResult = 0; }
/******************************************************************************* Function Name : OnClick Description : Event Handler. This handler will show the controls to edit the selected data from the list control only if signle click activate property is set. This will make list control editable with a single click. Member of : CFlexListCtrl Author(s) : Raja N Date Created : 22.07.2004 Modifications : Raja N on 01.08.2004, Modified the function name ShowControl as vShowControl. *******************************************************************************/ void CFlexListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult) { if( m_bSingleClickActivate == TRUE ) { // Set the focus to the list control if( GetFocus() != this) { SetFocus(); } NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // Call Handler Function with required parameters vShowControl(pNMListView->iItem, pNMListView->iSubItem); } *pResult = 0; }
/******************************************************************************* Function Name : OnClick Description : Event Handler. This handler will show the controls to edit the selected data from the list control only if signle click activate property is set. This will make list control editable with a single click. Member of : CLinFlexListCtrl Author(s) : Raja N Date Created : 22.07.2004 Modifications : Raja N on 01.08.2004, Modified the function name ShowControl as vShowControl. *******************************************************************************/ void CLinFlexListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; if(pNMListView != NULL) { // Call Handler Function with required parameters m_nRow = pNMListView->iItem; m_nColumn = pNMListView->iSubItem; sUserProgInfo ouUserProg; //TODO::Lot of If Statements has to reduced; if( m_omUserProg.Lookup(lGetMapID(m_nRow, m_nColumn) , ouUserProg) == TRUE ) { if ( ouUserProg.m_bIcon == true ) { CRect omRect; GetSubItemRect(m_nRow, m_nColumn, LVIR_ICON, omRect); if ( true == omRect.PtInRect( pNMListView->ptAction ) ) { if ( ouUserProg.m_pfHandler != NULL ) { ouUserProg.m_pfHandler(this, m_nRow, m_nColumn, ouUserProg.m_pUserParam); return; } } } } if( m_bSingleClickActivate == TRUE ) { // Set the focus to the list control if( GetFocus() != this) { SetFocus(); } //m_nCurrentCell = pNMListView->iItem * GetHeaderCtrl()->GetItemCount() + pNMListView->iSubItem ; // lGetMapID(pNMListView->iItem, pNMListView->iSubItem); vShowControl(pNMListView->iItem, pNMListView->iSubItem); } } *pResult = 0; }
/******************************************************************************* Function Name : vGoToEditMode Inputs : nRow - Row Index nColumn - Column Index Output : - Description : This function will be called to show the control to edit the item. This will be useful to show the control during invalid input entered by the user Member of : CFlexListCtrl Author(s) : Raja N Date Created : 22.07.2004 Modifications : Raja N on 30.07.2004, Renamed the function name as per code review comments. *******************************************************************************/ void CFlexListCtrl::vGoToEditMode(int nItem, int nSubItem) { // Show Appropriate UI controls vShowControl(nItem, nSubItem); }
void CFlexListCtrl::selectNext (int nIncrement) { int nCurrentCell = m_nCurrentCell; if ( nIncrement < 0 ) { nCurrentCell += nIncrement; while( nCurrentCell > 0 ) { SLISTINFO sInfo; int r = nCurrentCell / GetHeaderCtrl()->GetItemCount(); int c = nCurrentCell % GetHeaderCtrl()->GetItemCount(); if( m_omListItemType.Lookup(lGetMapID(r,c), sInfo) == TRUE ) { m_nCurrentCell = nCurrentCell; vShowControl(r, c); break; } nCurrentCell--; } } else { int nTotalItems = GetItemCount() * GetHeaderCtrl()->GetItemCount(); nCurrentCell += nIncrement; while( nCurrentCell < nTotalItems ) { SLISTINFO sInfo; int r = nCurrentCell / GetHeaderCtrl()->GetItemCount(); int c = nCurrentCell % GetHeaderCtrl()->GetItemCount(); if( m_omListItemType.Lookup(lGetMapID(r,c), sInfo) == TRUE ) { m_nCurrentCell = nCurrentCell; vShowControl(r, c); break; } nCurrentCell++; } } // int cItems = GetItemCount (); // int iItem = -1; // // iItem = GetNextItem (iItem, LVIS_SELECTED); // int iEditItem = 0; // SetFocus (); //int nNextCell = ( m_nCurrentCell + 1 ) % m_nTotalCell; // int nItem = nNextCell / cItems; // int nSubItems = nNextCell % GetHeaderCtrl()->GetItemCount(); // if (Forward) // { // // if (iItem + 1 >= cItems) // iEditItem = 0; // else // iEditItem = iItem + 1; // } // else // { // if (iItem - 1 < 0) // iEditItem = cItems - 1; // else // iEditItem = iItem - 1; // } //m_nCurrentCell = nItem*GetItemCount() + nSubItems; // vShowControl(nItem, nSubItems); } // selectNext