Solved

Right Mouse in Dialog?

Posted on 1997-03-05
1
207 Views
Last Modified: 2010-04-10
I am trying to detect a right mouse button click in an edit control within a dialog.  I have coded:
BEGIN_MESSAGE_MAP
     ON_WM_RBUTTONDOWN()
     ...
END_MESSAGE_MAP

-- in dialog class definition --
Protected:
   afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
   ....

-- in dialog class code --
void CSect2::OnRButtonDown(UINT nFlags, CPoint point)
{
   CWnd*  pCurWnd;

   pCurWnd = WindowFromPoint(point);
   if (pCurWnd == GetDlgItem(IDC_ITEM))
  {
      .....
   }
}

In debug mode, I get a break if the mouse click is in the dialog window outside of the edit control, but NO break if mouse click is in edit control.  How do I detect mouse click in edit control ?

Any help is appreciated.  Thanks
0
Comment
Question by:PRoss
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
xbwen earned 100 total points
ID: 1162132
 Because the edit control is another window, it the child of the dialog, so you cann't catch the RBUTTONDOWN, you can use EN_CHANGE,EN_UPDATE etc to catch the message from child window.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question