ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Mouse Usage
Posted by Raimund Gottkehaskamp on Apr-02-2023 19:25
In your examples, the form of mouse usage is carried out via a button and then implemented in the source code with "setMouseUsage". This seems very impractical to me. It would be better if you could control the mouse usage via the mouse itself, e.g. dragging the mouse with the left mouse button down: zooming, dragging the mouse with the right mouse button down: scrolling.

Is there a simple way to implement something like this?

Regards,
Raimund

  Re: Mouse Usage
Posted by Peter Kwan on Apr-03-2023 15:55
Hi Raimund,

With the left button for "zooming" (I assume that means to drag a rectangle to zoom-into) and right button for scrolling, how can we zoom-out? We may still need a button to select the zoom out mode, but then we need another button to switch back to zoom in mode and it would be similar to the user interface in the sample code.

I think the easiest method to control zooming and scrolling is to use the mouse wheel for zooming, and mouse drag (with left button down) for scrolling. This is supported in desktop applications in ChartDirector. (Are you writing a desktop of web application?)

The mouse right click is normally used for context menus. When you right click, users may expect a context menu to pop up. That's why we avoid using the right mouse button, so the application programmer can use it for context menus.

The left mouse button can be used to zoom-in or out. It can also be used to click on hot spots on the chart or for other purpose. All these usage are not hard code but configurable in ChartDirector. You can use setMouseUsage to determine how you want to use the mouse. In our sample code, we use push buttons to configure the mouse mode, but you can always use other methods.

You can also implement your own method to control zooming or scrolling. For example, in some of our sample code, we demonstrate using traditional scrollbar to control scrolling by adjusting the viewport, and we demonstrate using a slider for zooming. You can always handle the right mouse button with your own code to use it to control scrolling.

Best Regards
Peter Kwan