<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'OnMouseDown event for a button' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'OnMouseDown event for a button' posted on the 'C++ MFC' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sun, 19 May 2013 02:00:30 -0700</pubDate>
    <lastBuildDate>Sun, 19 May 2013 02:00:30 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>OnMouseDown event for a button</title>
      <link>http://www.programmersheaven.com/mb/mfc_coding/130992/130992/onmousedown-event-for-a-button/</link>
      <description>i have a dialog with a button placed on it. when the programm is running i want to trigger the WM_LBUTTONDOWN-Message on the button, that's why i've implemented the following function: &lt;br /&gt;
void CTestDlg::OnLButtonDown(UINT nFlags, CPoint point)&lt;br /&gt;
{&lt;br /&gt;
CRect Rect;&lt;br /&gt;
Button1.GetWindowRect(Rect);//Breakpt&lt;br /&gt;
ClientToScreen(&amp;amp;point);&lt;br /&gt;
if (Rect.PtInRect(point))&lt;br /&gt;
Button1.SetWindowText("Release me!");&lt;br /&gt;
&lt;br /&gt;
CDialog::OnLButtonDown(nFlags, point);&lt;br /&gt;
}&lt;br /&gt;
The curios thing about that function is that it is being called when i perform the mouse-down event ontop of the window. but when i perform the mouse-down event ontop of the button, then it is not called, because there is no break at the breakpoint. &lt;br /&gt;
does anyone know how to fix that???&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/mfc_coding/130992/130992/onmousedown-event-for-a-button/</guid>
      <pubDate>Sat, 03 Aug 2002 13:41:23 -0700</pubDate>
      <category>C++ MFC</category>
    </item>
    <item>
      <title>Re: OnMouseDown event for a button</title>
      <link>http://www.programmersheaven.com/mb/mfc_coding/130992/133448/re-onmousedown-event-for-a-button/#133448</link>
      <description>&lt;br /&gt;
Hi.&lt;br /&gt;
&lt;br /&gt;
This is just a suggestion as I didn't try it out, but it might help:&lt;br /&gt;
The WM_LBUTTONDOWN is sent to the button, not to your dialog, that's why your dialog doesn't recieve it. Add a message handler for the button too and you have solved the problem.&lt;br /&gt;
 If you still want your main window to get the WM_LBUTTONDOWN message even if it's on the button, you can send this message from the button's message handler to it's parent window.&lt;br /&gt;
 Hope this helps.&lt;br /&gt;
&lt;br /&gt;
: i have a dialog with a button placed on it. when the programm is running i want to trigger the WM_LBUTTONDOWN-Message on the button, that's why i've implemented the following function: &lt;br /&gt;
: void CTestDlg::OnLButtonDown(UINT nFlags, CPoint point)&lt;br /&gt;
: {&lt;br /&gt;
: CRect Rect;&lt;br /&gt;
: Button1.GetWindowRect(Rect);//Breakpt&lt;br /&gt;
: ClientToScreen(&amp;amp;point);&lt;br /&gt;
: if (Rect.PtInRect(point))&lt;br /&gt;
: Button1.SetWindowText("Release me!");&lt;br /&gt;
: &lt;br /&gt;
: CDialog::OnLButtonDown(nFlags, point);&lt;br /&gt;
: }&lt;br /&gt;
: The curios thing about that function is that it is being called when i perform the mouse-down event ontop of the window. but when i perform the mouse-down event ontop of the button, then it is not called, because there is no break at the breakpoint. &lt;br /&gt;
: does anyone know how to fix that???&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/mfc_coding/130992/133448/re-onmousedown-event-for-a-button/#133448</guid>
      <pubDate>Fri, 16 Aug 2002 11:45:06 -0700</pubDate>
      <category>C++ MFC</category>
    </item>
    <item>
      <title>Re: OnMouseDown event for a button</title>
      <link>http://www.programmersheaven.com/mb/mfc_coding/130992/425298/re-onmousedown-event-for-a-button/#425298</link>
      <description>A button sends a BN_CLICKED message to its owner when it is clicked. Use that.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/mfc_coding/130992/425298/re-onmousedown-event-for-a-button/#425298</guid>
      <pubDate>Mon, 17 Oct 2011 23:07:01 -0700</pubDate>
      <category>C++ MFC</category>
    </item>
  </channel>
</rss>