Can someone explain in simple terms why I can get a callback to work on a MouseUp event but not on MouseDown?
If I use the old Dyalog GUI controls both MouseDown and MouseUp work as expected/wanted, session snippet (you can work out what's in <owdown> and <owup>)...
f←⎕new 'Form' ''
f.onMouseDown←'owdown'
f.onMouseUp←'owup'
f.Wait
ow, you pressed me
that's a relief
But if I try the exact equivalent in a WPF/XAML-defined Window only the MouseUp event fires.
I see exactly equivalent (mis)behaviour with the KeyDown and KeyUp events.
Web search turns up the gnomic "MouseDown will only be bubbled from a hittable element"; but no matter how hard I hit the mouse/key nothing happens on the way down.
MouseDown versus MouseUp?
- Dick Bowman
- Posts: 235
- Joined: Thu Jun 18, 2009 4:55 pm
- Contact:
MouseDown versus MouseUp?
Visit http://apl.dickbowman.com to read more from Dick Bowman
Re: MouseDown versus MouseUp?
Hello Dick, this is working for me:
When you click on the Window the events MouseDown and MouseUp are fired.
Code: Select all
∇MouseDown[⎕]∇
[0] MouseDown(sender event)
[1] ⎕←'MouseDown at position: ',event.GetPosition sender
∇MouseUp[⎕]∇
[0] MouseUp(sender event)
[1] ⎕←'MouseUp at position: ',event.GetPosition sender
⎕USING←'System.Windows,WPF/PresentationFramework.dll'
win ← ⎕NEW Window
win.onMouseDown ← 'MouseDown'
win.onMouseUp ← 'MouseUp'
win.Show
When you click on the Window the events MouseDown and MouseUp are fired.
- MikeHughes
- Posts: 86
- Joined: Thu Nov 26, 2009 9:03 am
- Location: Market Harborough, Leicestershire, UK
Re: MouseDown versus MouseUp?
It's a well documented bug. Apparently the default handler sets the Handled property to 1.
The recommended work around is to use Preview mouse Down
The recommended work around is to use Preview mouse Down