MouseDown versus MouseUp?
3 posts
• Page 1 of 1
MouseDown versus MouseUp?
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.
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.
Visit http://apl.dickbowman.com to read more from Dick Bowman
-
Dick Bowman - Posts: 235
- Joined: Thu Jun 18, 2009 4:55 pm
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.
-
PGilbert - Posts: 440
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
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
-
MikeHughes - Posts: 86
- Joined: Thu Nov 26, 2009 9:03 am
- Location: Market Harborough, Leicestershire, UK
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group