0

I have an application written in C# targeting .NET Compact Framework 3.5, running on Windows CE. I would like to provide a custom visual cue in a modal dialog if the user tries to interact with its owner window without closing the dialog first.

Is it possible for a modal dialog to receive notifications of mouse clicks on its owner window? The owner window is running in full screen, so it would be sufficient to trap clicks outside of the modal dialog in general.

Tormod Fjeldskår
  • 5,952
  • 1
  • 29
  • 47

2 Answers2

4

This is how modality works. When a dialog is shown modally (CE or desktop Windows) that window gets it's own internal message pump. What that means is that wehn you get a message (like a mouse down) outside of your Window, the pump discards it. There's no way for the pump to dispatch that message "up" the chain to another pump (well not without you mucking with both pumps yourself - it's possible yes, but complex, convoluted, and not at all scalable or maintainable).

ctacke
  • 66,480
  • 18
  • 94
  • 155
0

You could probably use the Control.Capture property.

dommer
  • 19,610
  • 14
  • 75
  • 137
  • I'm not able to make this work. I set the Form's Capture property to true before calling the ShowDialog method, but I'm not receiving any Click events when clicking outside the dialog. – Tormod Fjeldskår Mar 30 '09 at 11:13
  • Is it possible that the form needs to be visible to have the capture set? – dommer Mar 30 '09 at 11:23
  • I've tried ensuring the Form is visible before setting the Capture property, but still no luck. Might be a Windows CE quirk... – Tormod Fjeldskår Mar 30 '09 at 11:45