BCGSoft Forums
BCGSoft Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 BCGControlBar Pro for MFC Forums
 BCGControlBar Professional Edition
 CBCGPOutlookBarPane Context Menu

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Insert Smilie
   
Message:

* HTML is OFF
* Forum Code is ON

 
   

T O P I C    R E V I E W
Hazelnut Posted - 06/11/2022 : 6:35:18 PM
Hello Support,

I have a need for a context menu on the Outlook shortcuts window in my application. The options on the menu will change depending on the focused button when the user right clicks on it. I have added OnToolbarContextMenu and OnContextMenu handlers to the derived CBCGPOutlookBarPane which seem to work. However, at this point, I can't figure out if it is possible to find the ID or index of the button that has the focus - is that possible?

If not possible, can you suggest a similar method to the Outlook control that would allow me to do such things?

Thank You!
4   L A T E S T    R E P L I E S    (Newest First)
Hazelnut Posted - 06/13/2022 : 05:37:24 AM
Hello, OK, yes the following corrected the output:

pTestPane->ScreenToClient(&Testpoint);


Thank You
Support Posted - 06/13/2022 : 12:10:14 AM
As we mentioned "LPARAM is a clicked point in screen coordinates", so you've to translate it to client coordinates.
Hazelnut Posted - 06/12/2022 : 9:18:56 PM
Hello, Thank you for the advice - I tried it. There seems to be some problem with HitTest.

I added the following to handler to display the HitTest return:


LRESULT CMainFrame::OnToolbarContextMenu(WPARAM wp,LPARAM lp)
{
	CPoint point (BCG_GET_X_LPARAM(lp), BCG_GET_Y_LPARAM(lp));

	m_pCurrOutlookPage = DYNAMIC_DOWNCAST (	CBCGPOutlookBarPane, 
							CWnd::FromHandlePermanent ((HWND) wp));

	if (m_pCurrOutlookPage == NULL)
	{
		m_uiHilightedPage = (UINT)-1;
		return 1l;	// Default menu
	}


	{
//////////////////////////////////////////////////////////////////////
		int nRet = m_pCurrOutlookPage->HitTest(point);
		CString str;
		str.Format(_T("Hit %d"), nRet);
		AfxMessageBox(str);
//////////////////////////////////////////////////////////////////////
	}
....



In my application, there are 8 buttons in the pane. The first button returns 2, the 2nd button returns 3, the 3rd button returns 4, the 4th button returns 5 - all of the buttons seem to be offset by 1. This is consistent until reaching the 7th button and 8th buttons which both return -1.

Can you tell me if the code I have tried for the test is correct?

Thank You!
Support Posted - 06/12/2022 : 3:51:21 PM
Hi,

Please take a look at BCGPOutlookDemo example: WPARAM of OnToolbarContextMenu message handler is the active page (CBCGPOutlookBarPane*) HWND and LPARAM is a clicked point in screen coordinates

So, you may easily obtain the clicked button index using CBCGPOutlookBarPane::HitTest method

Best regards,


BCGSoft Forums © Copyright (c) 1998-2022 BCGSoft Co Ltd Go To Top Of Page
Snitz Forums 2000