bool CMainDialog::OnClickItem (void* pParam) { TEventUI* pEvent = (TEventUI*)pParam; if (pEvent->Type == UIEVENT_BUTTONDOWN) { CComboUI* pcbx = static_cast <CComboUI*> (m_pm.FindControl(_T ("combo2"))); CEditUI* pedit = static_cast <CEditUI*> (m_pm.FindControl(_T ("ComboEdit"))); assert (pedit); CContainerUI* pItem = static_cast <CContainerUI*> (pcbx->GetItemAt (pEvent->pSender->GetTag())); pedit->SetText(pItem->GetItemAt(2)->GetText()); } else if (pEvent->Type == UIEVENT_MOUSEENTER) { pEvent->pSender->SetBkColor(0xFF00FF00); } else if (pEvent->Type == UIEVENT_MOUSELEAVE) { pEvent->pSender->SetBkColor(0xFFFFFFFF); } return true; }
int CZiMainFrame::OnSelectSearch(TNotifyUI & msg) { CEditUI * pSearchEdit = DuiControl(CEditUI, _T("SearchEdit")); CComboUI * pSearchCombo = DuiControl(CComboUI, _T("SearchCombo")); LPCTSTR ptsSearchName = pSearchEdit->GetText().GetData(); Assert(pSearchEdit && pSearchCombo); Assert(ptsSearchName); int nIndex = pSearchCombo->GetCurSel(); if(nIndex < 0) return 0; CListLabelElementUI * pItem = static_cast<CListLabelElementUI*>( pSearchCombo->GetItemAt(nIndex)); Assert(pItem); Assert(nIndex < (int)m_searchNodes.size()); pSearchEdit->SetText(pItem->GetText()); CreateChatDailog(m_searchNodes[nIndex]); return 0; }