示例#1
0
void CSkinComboBox::OnLButtonDown(UINT nFlags, CPoint point)
{
	//设置焦点
	SetFocus();

	//效验数据
	if( m_SkinComboBoxEdit.GetSafeHwnd() == NULL ) return;

	if ( (m_SkinComboBoxEdit.GetStyle() & ES_READONLY) == 0 )
	{
		if (VerdictOverButton(point))
		{
			m_bArrowPress = TRUE;

			//显示列表
			ShowDropDown(GetDroppedState()==FALSE);
		}
	}
	else
	{
		m_bArrowPress = TRUE;

		//显示列表
		ShowDropDown(GetDroppedState()==FALSE);

		m_SkinComboBoxEdit.SetSel(0,0);
	}

	//更新按钮
	RedrawWindow(&m_rcArrow,NULL,RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
	//__super::OnLButtonDown(nFlags, point);
}
示例#2
0
BOOL CSchemaCombo::PreTranslateMessage(MSG* pMsg)
{
	if ( pMsg->message == WM_KEYDOWN )
	{
		if ( pMsg->wParam == VK_SPACE || pMsg->wParam == VK_RETURN )
		{
			if ( GetDroppedState() )
			{
				if ( ! OnClickItem( GetCurSel(), TRUE ) )
				{
					ShowDropDown( FALSE );
				}
				return TRUE;
			}
			else if ( pMsg->wParam == VK_SPACE )
			{
				ShowDropDown();
				return TRUE;
			}
		}
		else if ( pMsg->wParam == VK_DOWN )
		{
			if ( OnClickItem( GetCurSel() + 1, TRUE ) )
			{
				return TRUE;
			}
		}
	}
	return CComboBox::PreTranslateMessage( pMsg );
}
示例#3
0
BOOL CInPlaceList::OnEditchange()
{
    // TODO: Add your control notification handler code here

    m_bEdit = TRUE;
    DWORD dwGetSel = GetEditSel();
    WORD wStart = LOWORD(dwGetSel);
    WORD wEnd	= HIWORD(dwGetSel);
    GetWindowText(m_sTypedText);
    CString sEditText(m_sTypedText);
    sEditText.MakeLower();

    CString sTemp, sFirstOccurrence;
    const BOOL bEmpty = m_sTypedText.IsEmpty();
    POSITION pos = m_PtrList.GetHeadPosition();
    while(! bEmpty && pos)
    {
        CItemData* pData = m_PtrList.GetNext(pos);
        sTemp = pData->m_sItem;
        sTemp.MakeLower();
        if (StringIsLike(sEditText + "*", sTemp))
            AddItem(pData);
        else
            DeleteItem(pData);
    }

    if(GetCount() < 1 || bEmpty)
    {
        if(GetDroppedState())
            ShowDropDown(FALSE);
        else
        {
            pos = m_PtrList.GetHeadPosition();
            while(pos)
                AddItem(m_PtrList.GetNext(pos));
        }
    }
    else
    {
        ShowDropDown();
        FitDropDownToItems();
    }

    UpdateText(m_sTypedText);
    SetEditSel(wStart,wEnd);

    m_bEdit = FALSE;

    return Default() != 0;
}
BOOL CXTPSyntaxEditColorComboBox::PreTranslateMessage(MSG* pMsg)
{
	switch (pMsg->message)
	{
	case WM_KEYDOWN:
		{
			switch (pMsg->wParam)
			{
			case VK_ESCAPE:
				{
					if (GetDroppedState() == TRUE)
					{
						ShowDropDown(FALSE);
						NotifyOwner(CBN_SELENDCANCEL);
						return TRUE;
					}
				}
				break;

			case VK_SPACE:
			case VK_RETURN:
				{
					if (GetDroppedState() == TRUE)
					{
						m_iPrevSel = GetLBCurSel();
						ShowDropDown(FALSE);
						NotifyOwner(CBN_SELENDOK);
						return TRUE;
					}
				}
				break;

			case VK_UP:
			case VK_DOWN:
				{
					if (GetDroppedState() == FALSE)
					{
						m_iPrevSel = GetCurSel();
						ShowDropDown(TRUE);
						return TRUE;
					}
				}
				break;
			}
		}
	}

	return CComboBox::PreTranslateMessage(pMsg);
}
void CCheckComboBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	if ((nChar == VK_DOWN) || (nChar == VK_LEFT) || (nChar == VK_RIGHT) || (nChar == VK_UP))
		ShowDropDown();

	CComboBox::OnKeyDown(nChar, nRepCnt, nFlags);
}
LRESULT COXComboPickerCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
#if defined (_WINDLL)
#if defined (_AFXDLL)
	AFX_MANAGE_STATE(AfxGetAppModuleState());
#else
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
#endif
#endif

	LRESULT lResult=0;
	
	switch(message)
	{
	case CB_GETDROPPEDSTATE:
		lResult=GetDroppedState();
		break;

	case CB_SHOWDROPDOWN:
		ShowDropDown((BOOL)wParam);
		break;

	default:
		lResult=CComboBox::WindowProc(message,wParam,lParam);
		break;
	}

	return lResult;
}
示例#7
0
void CMyComboBox::OnCbnEditchange()
{
	// ユーザがテキストを変更したらコンボを閉じる
	if ( GetDroppedState() != FALSE ){
		ShowDropDown( FALSE );
	}
}
示例#8
0
BOOL CMyComboBox::PreTranslateMessage(MSG* pMsg)
{
	bool	ctrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
	if ( pMsg->message == WM_KEYDOWN){
		switch( pMsg->wParam ){
		case 'C':
			if ( ctrl ){
				Copy();
				return TRUE;
			}
			break;
		case 'X':
			if ( ctrl ) {
				Cut();
				return TRUE;
			}
			break;
		case 'V':
			if ( ctrl ) {
				Paste();
				return TRUE;
			}
			break;
		case VK_DOWN:
			if ( GetDroppedState() == FALSE ){
				ShowDropDown( TRUE );
			}
			break;
		}
	}

	return CComboBox::PreTranslateMessage(pMsg);
}
BOOL CLocalComboBox::PreTranslateMessage(MSG* pMsg)
{
	if (pMsg->message == WM_KEYDOWN)
	{
		CFormatBar* pBar = (CFormatBar*)GetParent();
		switch (pMsg->wParam)
		{
		case VK_ESCAPE:
			pBar->SyncToView();
			pBar->NotifyOwner(NM_RETURN);
			return TRUE;
		case VK_RETURN:
			pBar->NotifyOwner(NM_RETURN);
			return TRUE;
		case VK_TAB:
			pBar->GetNextDlgTabItem(this)->SetFocus();
			return TRUE;
		case VK_UP:
		case VK_DOWN:
			if ((GetKeyState(VK_MENU) >= 0) && (GetKeyState(VK_CONTROL) >=0) &&
				!GetDroppedState())
			{
				ShowDropDown();
				return TRUE;
			}
		}
	}
	return CComboBox::PreTranslateMessage(pMsg);
}
示例#10
0
void CPropTreeItemCombo::OnActivate( int activateType, CPoint point ) {
	// activate the combo box
	SetWindowPos( NULL, m_rc.left, m_rc.top, m_rc.Width() + 1, m_rc.Height() + m_nDropHeight, SWP_NOZORDER | SWP_SHOWWINDOW );
	SetFocus();
	if( GetCount() ) {
		ShowDropDown( TRUE );
	}
}
示例#11
0
BOOL CInPlaceList::PreTranslateMessage(MSG* pMsg)
{
    if (WM_KEYDOWN == pMsg->message)
    {
        if (VK_RETURN == pMsg->wParam)
        {
            ShowDropDown(FALSE);
        }
    }

    return CComboBox::PreTranslateMessage(pMsg);
}
COXComboPickerCtrl::~COXComboPickerCtrl()
{
	if(m_pDropDown!=NULL)
	{
		if(m_pDropDown->GetWindow()!=NULL && 
			::IsWindow(m_pDropDown->GetWindow()->GetSafeHwnd()) && GetDroppedState())
		{
			ShowDropDown(FALSE);
		}
		m_pDropDown->SetOwnerCombo(NULL);
	}
}
void COXComboPickerCtrl::OnKillFocus(CWnd* pNewWnd)
{
	if(pNewWnd!=this && m_pDropDown!=NULL && pNewWnd!=m_pDropDown->GetContainer() && 
		pNewWnd!=m_pDropDown->GetContainer()->GetAttachedWindow())
	{
		if(GetDroppedState())
		{
			ShowDropDown(FALSE);
		}
	}

	CComboBox::OnKillFocus(pNewWnd);
}
void COXComboPickerCtrl::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	if(m_pDropDown!=NULL)
	{
		if(!GetDroppedState())
		{
			ShowDropDown(TRUE);
		}
	}
	else
	{
		CComboBox::OnLButtonDblClk(nFlags,point);
	}
}
示例#15
0
LRESULT CEmbedComboBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	LRESULT lResult(0);
	lResult = CComboBox::WindowProc(message, wParam, lParam);
	switch (message) {
	case WM_DESTROY:
		if (mEmbedEditControl != NULL) {
			delete mEmbedEditControl;
			mEmbedEditControl = NULL;
		}
		break;
	case WM_SHOWWINDOW:
		if (!mEmbedEditControl) {
			CWnd *pChild(GetWindow(GW_CHILD));
			if (pChild) {
				mEmbedEditControl = new CEmbedEditControl();
				mEmbedEditControl->SubclassWindow(pChild->m_hWnd);
			}
		}
		if (wParam)
			ShowDropDown();
		break;
	case WM_KILLFOCUS:
		{
			CWnd *pChild(GetWindow(GW_CHILD));
			if (!pChild || pChild->m_hWnd != (HWND)wParam)
				GetParent()->SendMessage(WM_ENABLE_EMBED_CONTROL, 0, 0);
		}
		break;
	case WM_ENABLE_EMBED_CONTROL:
		GetParent()->SendMessage(WM_ENABLE_EMBED_CONTROL, wParam, lParam);
		break;
	case WM_KEYDOWN:
		{
			int commit(0);
			switch (wParam) {
			case VK_ESCAPE:
			case VK_CLEAR:
				commit = ECF_DONOT_COMMIT; // No commit
			case VK_ACCEPT:
			case VK_RETURN:
				GetParent()->SendMessage(WM_ENABLE_EMBED_CONTROL, commit, 0);
			}
		}
		break;
	}
	return lResult;
}
示例#16
0
void CSearchBox::OnEditchange() 
{
	// TODO: Add your control notification handler code here
	DWORD dwEditSel = GetEditSel();

	CString	strText;
	GetWindowText( strText );
	
	int nFind	=	FindString( 0, strText );
	SetCurSel( nFind );
	if( !GetDroppedState() )
		ShowDropDown( );
	SetWindowText( strText );

	SetEditSel( 0, -1 );
	SetEditSel( LOWORD(dwEditSel), HIWORD(dwEditSel) );
}
//----------------------------------------------------------------------
  //nsIRollupListener
//----------------------------------------------------------------------
NS_IMETHODIMP 
nsComboboxControlFrame::Rollup(PRUint32 aCount,
                               nsIContent** aLastRolledUp)
{
  if (aLastRolledUp)
    *aLastRolledUp = nsnull;

  if (mDroppedDown) {
    nsWeakFrame weakFrame(this);
    mListControlFrame->AboutToRollup(); // might destroy us
    if (!weakFrame.IsAlive())
      return NS_OK;
    ShowDropDown(PR_FALSE); // might destroy us
    if (!weakFrame.IsAlive())
      return NS_OK;
    mListControlFrame->CaptureMouseEvents(PR_FALSE);
  }
  return NS_OK;
}
示例#18
0
BOOL CBCGFontComboBox::PreTranslateMessage(MSG* pMsg)
{
	if (m_bToolBarMode &&
		pMsg->message == WM_KEYDOWN &&
		!CBCGToolbarFontCombo::IsFlatMode ())
	{
		CBCGToolBar* pBar = (CBCGToolBar*) GetParent ();

		switch (pMsg->wParam)
		{
		case VK_ESCAPE:
			if (BCGGetTopLevelFrame (this) != NULL)
			{
				BCGGetTopLevelFrame (this)->SetFocus ();
			}
			return TRUE;

		case VK_TAB:
			if (pBar != NULL)
			{
				pBar->GetNextDlgTabItem (this)->SetFocus();
			}
			return TRUE;

		case VK_UP:
		case VK_DOWN:
			if ((GetKeyState(VK_MENU) >= 0) && (GetKeyState(VK_CONTROL) >=0) &&
				!GetDroppedState())
			{
				ShowDropDown();
				return TRUE;
			}
		}
	}

	return CComboBox::PreTranslateMessage(pMsg);
}
void COXComboPickerCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	if(m_pDropDown!=NULL)
	{
		if(!GetDroppedState() && (nChar==VK_UP || nChar==VK_DOWN || nChar==VK_RETURN))
		{
			ShowDropDown(TRUE);
			return;
		}

		if(GetDroppedState())
		{
			CWnd* pDropdownCtrl=m_pDropDown->GetContainer()->GetAttachedWindow();
			ASSERT(::IsWindow(pDropdownCtrl->GetSafeHwnd()));
			if(::IsWindow(pDropdownCtrl->GetSafeHwnd()))
			{
				pDropdownCtrl->SendMessage(WM_KEYDOWN,nChar,MAKELONG(nRepCnt,nFlags));
				return;
			}
		}
	}

	CComboBox::OnKeyDown(nChar,nRepCnt,nFlags);
}
示例#20
0
void CSearchBox::OnSelendcancel()
{
	// TODO: Add your control notification handler code here
	if( m_bDoNothing )
		return;

	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 );
}
示例#21
0
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);
}
void CConsoleSymbolsCombo::OnSelchange() 
{
  ShowDropDown( TRUE);
}
示例#23
0
CInPlaceList::CInPlaceList(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
                           int nRow, int nColumn, 
                           COLORREF crFore, COLORREF crBack,
						   IEnumerator<tstring> *items, CString sInitText, 
						   UINT nFirstChar)
{
    m_crForeClr = crFore;
    m_crBackClr = crBack;

	m_nNumLines = 20;
	m_sInitText = sInitText;
 	m_nRow		= nRow;
 	m_nCol      = nColumn;
 	m_nLastChar = 0; 
	m_bExitOnArrows = FALSE; //(nFirstChar != VK_LBUTTON);	// If mouse click brought us here,

	// Create the combobox
 	DWORD dwComboStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL| CBS_SORT |
 					     CBS_AUTOHSCROLL | dwStyle;
	int nHeight = rect.Height();
	rect.bottom = rect.bottom + m_nNumLines*nHeight + ::GetSystemMetrics(SM_CYHSCROLL);
	if (!Create(dwComboStyle, rect, pParent, nID)) return;

	// Add the strings	
	tstring item;
	items->Reset();
	while(items->MoveNext(item))
	{
		AddString(item.c_str());
	}		

	SetFont(pParent->GetFont());
	SetItemHeight(-1, nHeight);

    int nMaxLength = GetCorrectDropWidth();
    /*
    if (nMaxLength > rect.Width())
	    rect.right = rect.left + nMaxLength;
	// Resize the edit window and the drop down window
	MoveWindow(rect);
    */

	SetDroppedWidth(nMaxLength);

	SetHorizontalExtent(0); // no horz scrolling

	// Set the initial text to m_sInitText
    if (::IsWindow(m_hWnd) && SelectString(-1, m_sInitText) == CB_ERR) 
		SetWindowText(m_sInitText);		// No text selected, so restore what was there before

    ShowDropDown();

    // Subclass the combobox edit control if style includes CBS_DROPDOWN
    if ((dwStyle & CBS_DROPDOWNLIST) != CBS_DROPDOWNLIST)
    {
        m_edit.SubclassDlgItem(IDC_COMBOEDIT, this);
 	    SetFocus();
        switch (nFirstChar)
        {
            case VK_LBUTTON: 
            case VK_RETURN:   m_edit.SetSel((int)_tcslen(m_sInitText), -1); return;
            case VK_BACK:     m_edit.SetSel((int)_tcslen(m_sInitText), -1); break;
            case VK_DOWN: 
            case VK_UP:   
            case VK_RIGHT:
            case VK_LEFT:  
            case VK_NEXT:  
            case VK_PRIOR: 
            case VK_HOME:  
            case VK_END:      m_edit.SetSel(0,-1); return;
            default:          m_edit.SetSel(0,-1);
        }
        SendMessage(WM_CHAR, nFirstChar);
    }
    else
 	    SetFocus();
}
示例#24
0
CInPlaceList::CInPlaceList(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
                           int nRow, int nColumn,
                           Strings& Items,
                           CString sInitText,
                           UINT nFirstChar)
{
    m_nNumLines = 2;
    m_sInitText = sInitText;
    m_nRow		= nRow;
    m_nCol      = nColumn;
    m_nLastChar = 0;
    m_bEdit = FALSE;

    // Create the combobox
    DWORD dwComboStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL|
                         CBS_AUTOHSCROLL | dwStyle;

    if (!Create(dwComboStyle, rect, pParent, nID))
        return;

    COMBOBOXINFO cbInfo;
    cbInfo.cbSize = sizeof(COMBOBOXINFO);
    GetComboBoxInfo(&cbInfo);

    m_edit.SubclassWindow(cbInfo.hwndItem);
    m_ListBox.SubclassWindow(cbInfo.hwndList);

    // Add the strings
    for (size_t i = 0; i < Items.size(); i++)
        AddString(Items[i]);

    // Get the maximum width of the text strings
    int nMaxLength = 0;
    CClientDC dc(GetParent());
    CFont* pOldFont = dc.SelectObject(pParent->GetFont());

    for (size_t i = 0; i < Items.size(); i++)
        nMaxLength = max(nMaxLength, dc.GetTextExtent(Items[i]).cx);

    nMaxLength += (::GetSystemMetrics(SM_CXVSCROLL) + dc.GetTextExtent(_T(" ")).cx*2);
    dc.SelectObject(pOldFont);

    // Resize the edit window and the drop down window

    SetFont(pParent->GetFont());

    SetDroppedWidth(nMaxLength);
    SetHorizontalExtent(0); // no horz scrolling

    // Set the initial text to m_sInitText
    SetWindowText(m_sInitText);		// No text selected, so restore what was there before
    ShowDropDown();

    SetFocus();

    // Added by KiteFly. When entering DBCS chars into cells the first char was being lost
    // SenMessage changed to PostMessage (John Lagerquist)
    switch (nFirstChar)
    {
    case VK_RETURN:
        break;

    default:
        PostMessage(WM_CHAR, nFirstChar);
    }
}