BOOL CGroupView::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if( WM_KEYDOWN == pMsg->message ) { int nVirtKey = (int) pMsg->wParam; if( VK_RETURN == nVirtKey ) { CTreeCtrl &treectrl = GetTreeCtrl(); HTREEITEM hItem = treectrl.GetSelectedItem(); CString strText = treectrl.GetItemText(hItem); if( NULL != hItem ) { DWORD dwData = treectrl.GetItemData(hItem); if( GV_ITEM_GROUP == dwData ) AfxShowSlist( CStockContainer::typeGroup, strText ); else if( GV_ITEM_DOMAIN == dwData ) AfxShowSlist( CStockContainer::typeDomain, strText ); SetFocus( ); } return TRUE; } } return CTreeView::PreTranslateMessage(pMsg); }
void CDateComboBox::OnSelendok() { // TODO: Add your control notification handler code here int nSel = GetCurSel(); if( CB_ERR != nSel ) { SetCurSel( nSel ); DWORD dwDate = GetItemData( nSel ); if( DWORD(-2) == dwDate ) { CCacheLoadDlg dlg; dlg.DoModal(); return; } else { int nType; CSPString strDomain; DWORD date; if( AfxGetSListStockContainer().GetCurrentType( &nType, &strDomain, &date ) && date != dwDate ) { AfxShowSlist( nType, strDomain, dwDate ); } } } SetCurrentWindowText( ); }
void CGroupView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here CTreeCtrl &treectrl = GetTreeCtrl(); HTREEITEM hItem = treectrl.GetSelectedItem(); CString strText = treectrl.GetItemText(hItem); if( NULL != hItem ) { DWORD dwData = treectrl.GetItemData(hItem); if( GV_ITEM_GROUP == dwData ) AfxShowSlist( CStockContainer::typeGroup, strText ); else if( GV_ITEM_DOMAIN == dwData ) AfxShowSlist( CStockContainer::typeDomain, strText ); SetFocus( ); } *pResult = 0; }
void CSListView::OnDblclkItem( int nStockIndex ) { CStockContainer & container = AfxGetSListStockContainer(); int nType; CSPString strDomain; DWORD dwDate = -1; if( nStockIndex >= 0 ) { container.GetCurrentType( &nType, &strDomain, &dwDate ); if( ( nType == CStockContainer::typeDomain && strDomain.IsEmpty() ) || ( nType == CStockContainer::typeGroup && strDomain.IsEmpty() ) ) { CStockInfo & info = container.GetStockInfoByID( nStockIndex ); AfxShowSlist( nType, CString(info.GetStockName()), dwDate ); } else AfxShowStockGraph( nStockIndex, TRUE ); } }
void CStrategyView::ExecuteStrategy( CStrategy * pStrategy, DWORD dwData ) { if( NULL != pStrategy ) { if( SV_ITEM_PROPERTY == dwData ) ::PostMessage( AfxGetMainFrame()->GetSafeHwnd(), WM_COMMAND, ID_STRATEGY_PROPERTY, 0 ); else if( SV_ITEM_STOCKS == dwData ) AfxShowSlist( CStockContainer::typeStrategy, NULL ); else if( SV_ITEM_RULE == dwData ) ::PostMessage( AfxGetMainFrame()->GetSafeHwnd(), WM_COMMAND, ID_STRATEGY_SETRULE, 0 ); else if( SV_ITEM_RATE == dwData ) ::PostMessage( AfxGetMainFrame()->GetSafeHwnd(), WM_COMMAND, ID_STRATEGY_SETRATE, 0 ); else if( SV_ITEM_SIMU == dwData ) AfxSwitchToStaticView( RUNTIME_CLASS(CSimuView) ); else if( SV_ITEM_REPORT == dwData ) ::PostMessage( AfxGetMainFrame()->GetSafeHwnd(), WM_COMMAND, ID_STRATEGY_REPORT, 0 ); else if( SV_ITEM_REALOP == dwData ) ::PostMessage( AfxGetMainFrame()->GetSafeHwnd(), WM_COMMAND, ID_STRATEGY_REALOP, 0 ); else AfxSwitchToStaticView( RUNTIME_CLASS(CSimuView) ); } }