Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » TreeCtrl ContextMenu Problem Collapse All
Subject Author Date
HeikoKortlang Apr 29, 2003 - 3:44 PM

I have a problem with your MDIDOCVIEW example.
I need a own Context Menu in the TreeCtrl, i tried with the OnContext Event but this is never reached.

Only the standard Context Menu is shown.

How can i change that i got the event?

The OnLButtonDblClk Event is ok.

Sergiy Lavrynenko Apr 30, 2003 - 12:24 AM

Hi,

Thank you for your interest. You have no problems with my MDIDOCVIEW sample at all :-)

The standard windows tree control does not receive WM_CONTEXTMENU message after right mouse button clicks. It receives this message only when keyboard context-menu-button has been pressed. You can test it with the SPY++ utility and tree control of the standard windows explorer or any other program.
Please add the WM_RBUTTONDOWN message handler to your CTreeCtrl-derived class like this:

void CMyTreeControl::OnRButtonDown(UINT nFlags, CPoint point)
{
CTreeCtrl::OnRButtonDown( nFlags, point );
ClientToScreen( & point );
SendMessage(
WM_CONTEXTMENU,
(WPARAM)m_hWnd,
MAKELPARAM( point.x, point.y )
);
}

Best regards,
Sergiy.