Hello,

In my app I have a UI control that responds to MouseUp events and opens a
FileDialog. If an item in the dialog is double-clicked (instead of clicking
on it then clicking OK) AND that item is over my UI control, the final
MouseUp of the double-click is registered by my control and its handler is
called, opening the FileDialog again.

The events happen in this order:

MouseDown
MouseUp
Dialog Opens
Double-click in dialog
Dialog closes
MouseUp
DialogOpens, etc.

I'm looking for suggestions on how to correct this. I've tried removing the
MouseUp handler when the FileDialog is opened, and adding it beck when it is
closed but that doesn't work; it still gets called. I've tried looking for
a way to "eat" the MouseUp but haven't found a way that works. For example,
purging the event queue or marking the event as being handled/ignored.

So, any suggestions?

Keith

Re: MouseUp event "falls through" FileDialog and activates control underneath by Uchiha

Uchiha
Thu Sep 15 14:35:45 CDT 2005

Okay this probably isn't the best solution but I got it working doing this:

I set the mouseUp event of a maximized form to spawn an openfiledialog.
The follwing made it work.

private void OpenDialog()
{
this.Hide();
OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowDialog();
Thread.Sleep(500);
this.Show();
}

I don't know exactly how long the Sleep has to be but it works on 500.
It's a bit of a minging work around, sorry.

Jax


"Keith" <keith@alh.com> wrote in message
news:%23hcirhiuFHA.4032@TK2MSFTNGP15.phx.gbl...
> Hello,
>
> In my app I have a UI control that responds to MouseUp events and opens a
> FileDialog. If an item in the dialog is double-clicked (instead of
clicking
> on it then clicking OK) AND that item is over my UI control, the final
> MouseUp of the double-click is registered by my control and its handler is
> called, opening the FileDialog again.
>
> The events happen in this order:
>
> MouseDown
> MouseUp
> Dialog Opens
> Double-click in dialog
> Dialog closes
> MouseUp
> DialogOpens, etc.
>
> I'm looking for suggestions on how to correct this. I've tried removing
the
> MouseUp handler when the FileDialog is opened, and adding it beck when it
is
> closed but that doesn't work; it still gets called. I've tried looking
for
> a way to "eat" the MouseUp but haven't found a way that works. For
example,
> purging the event queue or marking the event as being handled/ignored.
>
> So, any suggestions?
>
> Keith
>
>



Re: MouseUp event "falls through" FileDialog and activates control underneath by Andrew

Andrew
Mon Sep 19 23:58:05 CDT 2005

Maybe you could keep a flag in the OnMouseDown to determine if your control
received a mouse down and then only process the mouseup if the flag is true
and set the flag to false in the mouseup.

"Keith" <keith@alh.com> wrote in message
news:%23hcirhiuFHA.4032@TK2MSFTNGP15.phx.gbl...
> Hello,
>
> In my app I have a UI control that responds to MouseUp events and opens a
> FileDialog. If an item in the dialog is double-clicked (instead of
> clicking on it then clicking OK) AND that item is over my UI control, the
> final MouseUp of the double-click is registered by my control and its
> handler is called, opening the FileDialog again.
>
> The events happen in this order:
>
> MouseDown
> MouseUp
> Dialog Opens
> Double-click in dialog
> Dialog closes
> MouseUp
> DialogOpens, etc.
>
> I'm looking for suggestions on how to correct this. I've tried removing
> the MouseUp handler when the FileDialog is opened, and adding it beck when
> it is closed but that doesn't work; it still gets called. I've tried
> looking for a way to "eat" the MouseUp but haven't found a way that works.
> For example, purging the event queue or marking the event as being
> handled/ignored.
>
> So, any suggestions?
>
> Keith
>