sublime99
March 4th, 2008, 12:39 PM
I have a right click popup menu for a treeview. I would like to enable a right click select and popup simultaneously (like in explorer). At the moment the user must select the item in the treeview with the left mouse and then right rlick. i have having difficulty determining the right combinations. Also i have not been able to capture WM_RBUTTONDOWN
thanks
here is the callback code:
//=============================================================================
LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam){
switch (uMsg) {
case WM_COMMAND:
return OnCommand(hwnd, uMsg, wParam, lParam);
case WM_CREATE:
{
return OnCreate(hwnd,reinterpret_cast<CREATESTRUCT*>(lParam));
}
case WM_DESTROY:
{
OnDestroy(hwnd);
return 0;
}
case WM_SIZE:
{
OnSize(hwnd,LOWORD(lParam),HIWORD(lParam),static_cast<UINT>(wParam));
return 0;
}
case WM_NOTIFY:
{
case IDC_TREE1:
{
if(((LPNMHDR)lParam)->code == NM_RCLICK) {
return 0;
}
// some tests
// selection has changed : set global variable to keep track
//...
} // if
return 0;
} // IDC_TREE1
return 0;
} // WM_NOTIFY
case WM_CONTEXTMENU:
{
OnContextMenu(hwnd);
return 0;
}
case WM_DROPFILES:
{
//...
return 0;
}
default:
//let system deal with msg
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
}
thanks
here is the callback code:
//=============================================================================
LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam){
switch (uMsg) {
case WM_COMMAND:
return OnCommand(hwnd, uMsg, wParam, lParam);
case WM_CREATE:
{
return OnCreate(hwnd,reinterpret_cast<CREATESTRUCT*>(lParam));
}
case WM_DESTROY:
{
OnDestroy(hwnd);
return 0;
}
case WM_SIZE:
{
OnSize(hwnd,LOWORD(lParam),HIWORD(lParam),static_cast<UINT>(wParam));
return 0;
}
case WM_NOTIFY:
{
case IDC_TREE1:
{
if(((LPNMHDR)lParam)->code == NM_RCLICK) {
return 0;
}
// some tests
// selection has changed : set global variable to keep track
//...
} // if
return 0;
} // IDC_TREE1
return 0;
} // WM_NOTIFY
case WM_CONTEXTMENU:
{
OnContextMenu(hwnd);
return 0;
}
case WM_DROPFILES:
{
//...
return 0;
}
default:
//let system deal with msg
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
}