Losing mouse navigation after viewing custom context menu

Oct 25, 2010 at 6:25 PM

Hello,

my problem is quite simple, though I don't know why it is happening. I've set a custom context menu. When I right-click on the chart and bring up the context menu (I'm not clicking on the menu item itself so it's not related to that) I then can't navigate (pan/zoom) with the left mouse button on the chart anymore. Neither within the chart area, or on the axis. I can, however, still use the scroll wheel. Right clicking again will still bring up the context menu, but after a few right-clicks the context menu will not appear and the left button mouse navigation will return. Right clicking yet again repeats the cycle.

Any thoughts?

Thanks,
Andrew 

Oct 26, 2010 at 1:50 PM

I suggest debugging the keyboard and mouse navigation classes and the default context menu class. I have to say, as much as I like this library, I found these classes to have some problems. On my machine, for example, '+' above the number 1 would zoom, while on the numeric keypad it would not. '-' would not zoom out at all.

If you dig into these classes, you will notice that there is some keyboard handling in the mouse navigation class ("Esc" to stop an operation), some mouse handling the in the keyboard class, and some in the menu class (right click to show menu). And some things (like the +/- zooming) that are ultimately implemented using the WPF command system. This results in some confusion when trying to determine what is happening, and some conflicts as well. Double right mouse click is supposed to zoom out - but that conflicts with the context menu.

I created a new navigation class that combines code from these existing classes. I started doing that because I had requirements for some new mouse operations in my application. But a nice side effect was I was able to resolve some of the the above problems. I realized double-mouse click was going to always conflict with the context menu (unless you use a timer to deal with it - not worthwhile, IMO), and did away with that. I chunked the WPF command bindings and simply implemented +/- zooming directly, and now they work. I added the stuff I needed and got rid of what I didn't. I think it was worth the effort, because now I'm dealing with one class, the code is clean, and it will be easy going foward to add more features.

I'm not suggesting you have to go that far. But you will probably need to debug the D3 code to see what is happening.

Jim

Oct 26, 2010 at 2:17 PM

Thanks Jim,

I think i'll give just that a try. I've been reluctant to modify the D3 source, but as you mentioned it`s probably the best way to deal with this and other issues.

Regards,
Andrew 

Oct 26, 2010 at 6:04 PM

Ok, remember you don't have modify the source directly - derive your own navigation class, using the existing code as a model. Clear the existing objects from your plotter and replace with our own, etc.

 

Editor
Nov 7, 2010 at 8:16 AM

Hi!

My name is Mikhail Brinchuk, and I am a developer of DynamicDataDisplay.

I'm searching now a remote job, so if you or your company can offer it to me, I will be very grateful.

If you want to customize DynamicDataDisplay somehow, I can help you to do it.

My CV is here - https://sites.google.com/site/thecentury/

Best regards,

Mikhail.