How to detect clicks outside of a modal dialog

I have a modal dialog displaying a calendar. I want the dialog to cancel if
the user clicks out side of the dialog.

I have tried using SetCapture() in the dialogs OnInitDialog() but it mucks
things up with the controls on the dialog no longer working.

Has any one got any ideas how to achieve this.

thanks



0
davidp687 (1)
1/18/2005 1:07:13 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
319 Views

Similar Articles

[PageSpeed] 5

I'm not 100% clear on your arrangement but the ideal approach seems to be
for the dialog to cancel when it loses focus. One problem with implementing
this is that the dialog itself won't have focus, a child control will. So
you'd need to see how well this approach could be adapted to your particular
situation.

-- 
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm

"David Price" <davidp@start-global.com> wrote in message
news:OfSqh6V$EHA.3988@TK2MSFTNGP11.phx.gbl...
> I have a modal dialog displaying a calendar. I want the dialog to cancel
if
> the user clicks out side of the dialog.
>
> I have tried using SetCapture() in the dialogs OnInitDialog() but it mucks
> things up with the controls on the dialog no longer working.
>
> Has any one got any ideas how to achieve this.
>
> thanks
>
>
>


0
jwood (1292)
1/18/2005 7:52:07 PM
This sounds odd but you can achieve this by have process wide mouse hook
(SetWindowsHookEx).

--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


"David Price" <davidp@start-global.com> wrote in message
news:OfSqh6V$EHA.3988@TK2MSFTNGP11.phx.gbl...
> I have a modal dialog displaying a calendar. I want the dialog to cancel
if
> the user clicks out side of the dialog.
>
> I have tried using SetCapture() in the dialogs OnInitDialog() but it mucks
> things up with the controls on the dialog no longer working.
>
> Has any one got any ideas how to achieve this.
>
> thanks
>
>
>


0
ajaykalra (6842)
1/19/2005 2:16:06 AM
Reply:

Similar Artilces: