void CTxMsgWndJ1939::vPopulatePGNComboBox(void) { m_CS_ConfigData.Lock(); CSize omSize(0,0); m_omComboPGN.ResetContent(); const SMSGENTRY* psTemp = m_psMsgRoot; while (psTemp != NULL) { if (psTemp->m_psMsg != NULL) { CString omMsgIdWithName; omMsgIdWithName.Format(defSTR_MSG_ID_IN_HEX, psTemp->m_psMsg->m_unMessageCode); omMsgIdWithName += psTemp->m_psMsg->m_omStrMessageName; int nIndex = m_omComboPGN.AddString(omMsgIdWithName); CSize omTextSize = m_omComboPGN.GetDC()->GetTextExtent(omMsgIdWithName); if (omTextSize.cx > omSize.cx) { omSize = omTextSize; } m_omComboPGN.SetItemData(nIndex, psTemp->m_psMsg->m_unMessageCode); } psTemp = psTemp->m_psNext; } m_omComboPGN.SetHorizontalExtent(omSize.cx); m_omComboPGN.SetCurSel(0); m_CS_ConfigData.Unlock(); vAdjustWidthMessageComboBox(); }
/******************************************************************************* Function Name : vUpdateUnSelSubEntryList Input(s) : unMsgID - Message ID Output : Functionality : This function will be called to update signal names list when the message name selected got changed or during init to populate the Signal Names listbox Friend of : - Author(s) : Raja N Date Created : 25.03.2004 Modifications : K ArunKumar : 24.08.2010. Modifications to support data population from Wave form Data Handler. Raja N : 14.04.2004. Modifications as per Code Review. *******************************************************************************/ void CWaveformSelectionDlg::vPopulateUnSelSubEntryList(UINT unMainEntryID) { m_omListCtrlSignal.DeleteAllItems(); CStringArray arrSignalsList; //UINT nMsgID = unGetSelectedMainEntryID(); m_pWaveDataHandler->vGetAvailableSignalsInMsgID(unMainEntryID, arrSignalsList,true); UINT unMaxLen = 0; for(int nCount = 0; nCount<arrSignalsList.GetSize(); nCount++) { UINT unLen = m_omListCtrlSignal.GetStringWidth(arrSignalsList.GetAt(nCount)); // Save the length if it is the max. if(unMaxLen < unLen ) { unMaxLen = unLen; } m_omListCtrlSignal.InsertItem(nCount, arrSignalsList.GetAt(nCount)); } // Set the column width if it is valid if( unMaxLen > 0 ) { m_omListCtrlSignal.SetColumnWidth(0, unMaxLen + defSIZE_OF_IMAGE); } vAdjustWidthMessageComboBox(); }
/******************************************************************************* Function Name : vUpdateUnSelSubEntryList Input(s) : unMsgID - Message ID Output : Functionality : This function will be called to update signal names list when the message name selected got changed or during init to populate the Signal Names listbox Friend of : - Author(s) : Raja N Date Created : 25.03.2004 Modifications : Raja N : 14.04.2004. Modifications as per Code Review. *******************************************************************************/ void CSigWatchAddDelDlg::vPopulateUnSelSubEntryList(UINT unMainEntryID) { //CMainEntryList* psTemp = m_podTempCallerList; m_omListCtrlSignal.DeleteAllItems(); if (m_podTempCallerList != NULL) { SMAINENTRY sMainEntry; sMainEntry.m_unMainEntryID = unMainEntryID; POSITION pos = m_podTempCallerList->Find(sMainEntry); if ( pos != NULL) { sMainEntry = m_podTempCallerList->GetAt(pos); POSITION SubPos = sMainEntry.m_odUnSelEntryList.GetHeadPosition(); UINT unCountItem = 0; UINT unMaxLen = 0; while (SubPos != NULL) { SSUBENTRY& sSubEntry = sMainEntry.m_odUnSelEntryList.GetNext(SubPos); UINT unLen = m_omListCtrlSignal.GetStringWidth(sSubEntry.m_omSubEntryName); // Save the length if it is the max. if(unMaxLen < unLen ) { unMaxLen = unLen; } m_omListCtrlSignal.InsertItem(unCountItem++, sSubEntry.m_omSubEntryName); } // Set the column width if it is valid if( unMaxLen > 0 ) { m_omListCtrlSignal.SetColumnWidth(0, unMaxLen + defSIZE_OF_IMAGE); } } } vAdjustWidthMessageComboBox(); }