/****************************************************************************** Function Name : OnItemchangedLstcSelectedHwList Input(s) : Address of an NM_LISTVIEW structure that identifies the item that has changed and specifies its previous and new states Output : - Functionality : This function will be called by the framework when the user selects an item from the selected Hw List. This will UI buttons status based on the current selection Member of : CHardwareListingCAN Author(s) : Raja N Date Created : 08.09.2004 Modifications : ******************************************************************************/ void CHardwareListingCAN::OnItemchangedLstcSelectedHwList( NMHDR* pNMHDR, LRESULT* pResult) { //NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; CComboBox* pEditBaudRateCAN = (CComboBox*)GetDlgItem(IDC_CAN_EDIT_BAUD_RATE); CComboBox* pEditBaudRateCANFD = (CComboBox*)GetDlgItem(IDC_CANFD_EDIT_BAUD_RATE); if(nullptr!=pEditBaudRateCAN ) { pEditBaudRateCAN ->EnableWindow(TRUE); } // Update UI Buttons NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // If it is a selection change update the hardware details if(pNMListView->uNewState & LVIS_SELECTED) { // Get the selected Item index UINT nSelectedItem = pNMListView->iItem; m_nLastSelection = pNMListView->iItem; // Update selected Hw details vUpdateHwDetails( (INT)m_omSelectedHwList.GetItemData( nSelectedItem ) ); std::string omSelectedItem = m_omSelectedHwList.GetItemText( nSelectedItem, 0); std::map<std::string, bool>::iterator itr = m_mapChannelToCANFDStatus.find(omSelectedItem); if(m_mapChannelToCANFDStatus.end() != itr) { m_chkCANFD.EnableWindow(itr->second); } vFillControllerConfigDetails(); } else if( pNMListView->uChanged == LVIF_STATE && pNMListView->uOldState == LVIS_SELECTED ) { UpdateData( TRUE ); vValidateBaudRate(); vUpdateControllerDetails(); } if(m_omSelectedHwList.GetSelectedCount() == 0) { if(nullptr!=pEditBaudRateCAN) { pEditBaudRateCAN ->EnableWindow(FALSE); } if(nullptr!=pEditBaudRateCANFD) { pEditBaudRateCANFD ->EnableWindow(FALSE); } m_chkCANFD.SetCheck(BST_UNCHECKED); m_chkCANFD.EnableWindow(FALSE); m_omEditBaudRate.SetSel(0, -1); m_omEditBaudRate.Clear(); m_omCANFDEditBaudRate.SetSel(0, -1); m_omCANFDEditBaudRate.Clear(); } vEnableDisableButtons(); *pResult = 0; }
void CHardwareListing::OnNMClickLstcSelectedHwList(NMHDR* pNMHDR, LRESULT* pResult) { //NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // Update UI Buttons NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // If it is a selection change update the hardware details INT nSelectedItem = pNMListView->iItem; if(nSelectedItem > -1){ // Update selected Hw details vUpdateHwDetails( (INT)m_omSelectedHwList.GetItemData( nSelectedItem ) ); } vEnableDisableButtons(); *pResult = 0; }
/****************************************************************************** Function Name : OnItemchangedHWList Input(s) : Address of an NM_LISTVIEW structure that identifies the item that has changed and specifies its previous and new states Output : - Functionality : This function will be called by the framework when the user selects an item from the Hw List. This will update selected Hw details Member of : CHardwareListing Author(s) : Raja N Date Created : 08.09.2004 Modifications : Raja N on 14.03.2005, Modified to get item data for getting actual index. ******************************************************************************/ void CHardwareListing::OnItemchangedHWList(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // If it is a selection change update the hardware details if(pNMListView->uNewState & LVIS_SELECTED){ // Get the selected Item index m_nSelectedItem = pNMListView->iItem; // Update selected Hw details vUpdateHwDetails( (INT)m_omHardwareList.GetItemData( m_nSelectedItem ) ); } // Update Button Status vEnableDisableButtons(); *pResult = 0; }