[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