Page 1 of 1

ChartMouseListener events error using ZoomStyle.INCHART

Posted: Wed Aug 20, 2014 1:56 pm
by 17069217
Hi,

After starting to use the ZoomStyle.INCHART_MULTI im my charts, the ChartMouseListener events stopped working, how can I reuse the backgroundClicked(ChartMouseEvent arg0)) event with this style of zoom?

Code: Select all

chart.getZoom().setZoomStyle(ZoomStyle.INCHART_MULTI);

Code: Select all

chart1.addChartMouseListener(new ChartMouseListener() {
			
			@Override
			public void titleClicked(ChartMouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void legendClicked(ChartMouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void backgroundClicked(ChartMouseEvent arg0) {
				// TODO Auto-generated method stub
				
                               This event is no longer triggered with this zoom Style

			}
			
			@Override
			public void axesClicked(ChartMouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
		} );

Re: ChartMouseListener events error using ZoomStyle.INCHART

Posted: Thu Aug 21, 2014 11:11 am
by yeray
Hello Novus,

I could reproduce the problem so I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=894

Re: ChartMouseListener events error using ZoomStyle.INCHART

Posted: Thu Aug 21, 2014 11:13 am
by yeray
Hi again,

I've already found a fix for it so the next maintenance release will include it.

I see you own the TeeChart sources so here it is the fix:
At TChart.java, at the beginning of the onTouch method you'll see this:

Code: Select all

	public boolean onTouch(View v, MotionEvent event) {
	//...
		switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN: {
			if (chart.getZoom().getZoomStyle() != ZoomStyle.INCHART_MULTI)
			  triggerEvent(event, FrameworkMouseEvent.MOUSE_PRESSED);
	//...
Just remove the if condition to have this:

Code: Select all

	public boolean onTouch(View v, MotionEvent event) {
	//...
		switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN: {
			triggerEvent(event, FrameworkMouseEvent.MOUSE_PRESSED);
	//...

Re: ChartMouseListener events error using ZoomStyle.INCHART

Posted: Thu Aug 21, 2014 5:41 pm
by 17069217
thanks, I'll try to modify the source code here.