Beispiel #1
0
LRESULT formview::OnContextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
    CMenu formviewmenu;
    const POINT point = {LOWORD(lParam), HIWORD(lParam)};
    formviewmenu.LoadMenuA(IDR_LISTVIEWMENU);

    {
        LVITEMA item;
        CMenuHandle listviewmenu = formviewmenu.GetSubMenu(1);
        if(this->listview_m.GetSelectedItem(&item))
        {
            listviewmenu.SetMenuDefaultItem(ID_POPUP_OPEN);
            listviewmenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, *this);
            return 0;
        }
    }
    {
        CRect rect;
        this->listview_m.GetWindowRect(&rect);
        CMenuHandle listviewmenu = formviewmenu.GetSubMenu(0);
        if(rect.PtInRect(point))
            listviewmenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, *this);
    }

    return 0;
}
Beispiel #2
0
void CMainFrame::OnRButtonDown(UINT nFlags, CPoint point)
{
    // TODO: Add your message handler code here and/or call default
    CMenu pMenu;
    pMenu.LoadMenuA(IDR_MENUGRAPH);
    pMenu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTBUTTON, point.x, point.y, this);

    CFrameWnd::OnRButtonDown(nFlags, point);
}
Beispiel #3
0
void CTerminalTreeCtrl::OnRButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default

	CRect rect_Item;

	HTREEITEM hSelItem_cur = HitTest(point);
	if(hSelItem_cur != NULL)
	{
		GetItemRect(hSelItem_cur, &rect_Item, TRUE);
		if(PtInRect(rect_Item, point))
			Select(hSelItem_cur, TVGN_CARET);
		else return;
	}

	HTREEITEM hSelItem = GetSelectedItem();
	if(hSelItem != NULL)
	{
		GetItemRect(hSelItem, &rect_Item, TRUE);

		if(PtInRect(rect_Item, point))
		{
			POINT m_posScreen;
			RECT rect;
			GetWindowRect(&rect);

			m_posScreen.x = rect.left;
			m_posScreen.y = rect.top;
		
			m_posScreen.x += point.x;
			m_posScreen.y += point.y;
            
			ItemData *data = (ItemData *)GetItemData(hSelItem);
			if (data->m_type == ITEM_TYPE_TERMINAL)
			{				
				CMenu menu;
				menu.LoadMenuA(IDR_MAINFRAME);
				menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,m_posScreen.x,m_posScreen.y,this);				
			}			
		}
	}
	
	CTreeCtrl::OnRButtonDown(nFlags, point);
}