void CSearchBox::OnSelendok() { // TODO: Add your control notification handler code here if( m_bDoNothing ) return; int nSel = GetCurSel(); m_hwndLastFocus = NULL; m_bSegmentEnd = TRUE; if( CB_ERR != nSel ) { SetCurSel( nSel ); if( m_bShowOnSel ) { DWORD dwData = GetItemData( nSel ); CView * pView = AfxGetStaticDoc()->GetActiveView(); if( dwData & SEARCHBOX_SIGNBIT_STT ) AfxShowStockTech( dwData & ~SEARCHBOX_SIGNBIT_STT ); else if( dwData & SEARCHBOX_SIGNBIT_ACCE ) AfxExecuteAccelerator( dwData & ~SEARCHBOX_SIGNBIT_ACCE ); else if( pView && pView->IsKindOf( RUNTIME_CLASS(CRealTimeView) ) ) AfxShowStockRealTime( dwData, FALSE ); else AfxShowStockGraph( dwData, FALSE ); return; } } SetCurrentWindowText( ); if( m_bAutoHide ) SetWindowPos( NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW ); }
void RunLinkGraph() { CWizardView * pView = AfxGetWizardView(); if( pView && ::IsWindow(pView->GetSafeHwnd()) ) { CString strCode = pView->m_cmbStock.GetSelectedStockCode(); AfxShowStockGraph( strCode ); } }
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 ); } }
BOOL CSearchBox::PreTranslateMessage(MSG* pMsg) { if( pMsg->message == WM_KEYDOWN ) { if( IsWantChar( pMsg->wParam ) ) { OnChangeStatus( pMsg->wParam, pMsg->lParam, TRUE ); return TRUE; } if( VK_RETURN == pMsg->wParam ) { m_bDoNothing = TRUE; m_hwndLastFocus = NULL; m_bSegmentEnd = TRUE; CString strCommand; GetWindowText( strCommand ); int nSel = SelectString( 0, strCommand ); ShowDropDown( FALSE ); SetCurSel( nSel ); // Show Graph View if( CB_ERR != nSel && m_bShowOnSel ) { DWORD dwData = GetItemData( nSel ); CView * pView = AfxGetStaticDoc()->GetActiveView(); if( dwData & SEARCHBOX_SIGNBIT_STT ) AfxShowStockTech( dwData & ~SEARCHBOX_SIGNBIT_STT ); else if( dwData & SEARCHBOX_SIGNBIT_ACCE ) AfxExecuteAccelerator( dwData & ~SEARCHBOX_SIGNBIT_ACCE ); else if( IsCTRLpressed() ) AfxShowStockBase( dwData, FALSE ); else if( pView && pView->IsKindOf( RUNTIME_CLASS(CRealTimeView) ) ) AfxShowStockRealTime( dwData, FALSE ); else AfxShowStockGraph( dwData, FALSE ); } else if( CB_ERR == nSel && m_bShowOnSel ) { AfxShowStockGraph( strCommand ); } else SetCurrentWindowText( ); m_bDoNothing = FALSE; if( m_bAutoHide ) SetWindowPos( NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW ); return TRUE; } else if( VK_ESCAPE == pMsg->wParam ) { m_bDoNothing = TRUE; if( m_hwndLastFocus ) ::SetFocus( m_hwndLastFocus ); m_hwndLastFocus = NULL; m_bSegmentEnd = TRUE; CString strCommand; GetWindowText( strCommand ); int nSel = SelectString( 0, strCommand ); ShowDropDown( FALSE ); SetCurSel( nSel ); SetCurrentWindowText( ); m_bDoNothing = FALSE; if( m_bAutoHide ) SetWindowPos( NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW ); return TRUE; } } return CComboBox::PreTranslateMessage(pMsg); }