[Fwd: Right mouse button and depressed button] 
Author Message
 [Fwd: Right mouse button and depressed button]

[ Attached Message ]

From:
To:
Date: Wed, 25 Mar 1998 14:49:21 -0600
Local: Wed, Mar 25 1998 3:49 pm
Subject: Right mouse button and depressed button
In an application I'm coding, the user will have to be able to use
either mouse button to "depress" a dialog button.  When the left mouse
button is used, the dialog button gets the pressed look.  What can I do
that so that a similar thing happens when the right button is pushed?

Lynn R. Svedin



Fri, 15 Sep 2000 03:00:00 GMT  
 [Fwd: Right mouse button and depressed button]

Try coding this:
    void CMyWhatever::OnRButtonDown(UINT nFlags, CPoint point)

        this->OnLButtonDown(nFlags, point);
        }



Fri, 15 Sep 2000 03:00:00 GMT  
 [Fwd: Right mouse button and depressed button]



Quote:
>Try coding this:
>    void CMyWhatever::OnRButtonDown(UINT nFlags, CPoint point)

>        this->OnLButtonDown(nFlags, point);
>        }

Does this work?

My recollection is that CWhatever::OnWhatever() usually falls back to
call CWnd::Default(), which uses the original message info and thus
would do default right button handling even when called via
OnLButtonDown().

Don Grasberger
(remove --- from address to e-mail)



Sat, 16 Sep 2000 03:00:00 GMT  
 [Fwd: Right mouse button and depressed button]

Quote:
>>>In an application I'm coding, the user will have to be able to use
>>>either mouse button to "depress" a dialog button.  When the left mouse
>>>button is used, the dialog button gets the pressed look.  What can I do
>>>that so that a similar thing happens when the right button is pushed?

>>>Lynn R. Svedin
>>Try coding this:
>>    void CMyWhatever::OnRButtonDown(UINT nFlags, CPoint point)
>>        {
>>        this->OnLButtonDown(nFlags, point);
>>        }

>Does this work?

>My recollection is that CWhatever::OnWhatever() usually falls back to
>call CWnd::Default(), which uses the original message info and thus
>would do default right button handling even when called via
>OnLButtonDown().

Don,
    You're right. Although you could choose not to call the base class's
handler, apparently the wParam of the message passed does contain the button
clicked.
    On closer inspection, I would try overriding PreTranslateMessage like
this (although I'm not at all sure that this would work. Any gurus care to
clarify?):

BOOL CMyWhatever::PreTranslateMessage(MSG* pMsg)
{
    if (pMsg->message == WM_RBUTTONDOWN)
        {
        pMsg->message = WM_LBUTTONDOWN;
        pMsg->wParam &= ~MK_RBUTTON; // Kill right button flag
        pMsg->wParam &= MK_LBUTTON;  // Add left button
        return FALSE; // i.e., framework should continue processing MSG
        }

Quote:
}

Cheers,
    Gage




Sat, 16 Sep 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to use the right and middle mouse buttons

2. Treeview: Right Mouse Button

3. x and y coordinates when i click right mouse button

4. Right mouse button click in CTreeView?

5. Toggling the mouse buttons from right to left

6. Selection in tree with right mouse button

7. Select Listbox item by right (!)mouse button pressing

8. Pop up menu has my program (Right Mouse Button)

9. Right button mouse click in CListBox

10. CListBox and Right Mouse button

11. Overwriting Right Mouse Button click of edit boxes

12. Popup menu clicking the right mouse button

 

 
Powered by phpBB® Forum Software