This is a migrated thread and some comments may be shown as answers.

Trackball leaves stuff on the screen when disabled

1 Answer 96 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
scott
Top achievements
Rank 1
scott asked on 25 Feb 2013, 03:48 PM
Hi.  I have a trackball setup on a chart.

chart.Controllers.Add(new ChartTrackballController());
chart.ShowTrackBall = false;

I have a click handler that toggles the trackball. 

private void chart_MouseClick(object sender, MouseEventArgs e)
{
    if (e.Button == System.Windows.Forms.MouseButtons.Right)
    {
        chart.ShowTrackBall = !chart.ShowTrackBall;
    }
}


When I disable the trackball it leaves its message box on the screen...  If I toggle the trackball a bunch of times, I end up with a bunch of message boxes on the screen... 

See the pix for a sample.

Thoughts? -
Thanks


1 Answer, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 28 Feb 2013, 02:36 PM
Hello Scott,

Thank you for writing.

I was able to reproduce the issue and have logged it in our Public Issue Tracking System - PITS. You can track its progress, subscribe for status changes and add your vote/comment on the following link - PITS Issue. 
To workaround this issue you can create a custom trackball controller deriving from the default one. In the custom controller you should override the ControllerRemoved method. Your code might look like this:
public class MyTrackballController : ChartTrackballController
{
    protected override void ControllerRemoved()
    {
        base.ControllerRemoved();
 
        ChartView view = this.Area.Parent as ChartView;
        ChartWrapper chartWrapper = view.Owner as ChartWrapper;
 
        if (chartWrapper.Children.Contains(this.Element))
        {
            chartWrapper.Children.Remove(this.Element);
        }
    }
}

You will also have to modify your click event handler to use your custom controller:
private void radChartView1_MouseClick(object sender, MouseEventArgs e)
{
    if (e.Button == System.Windows.Forms.MouseButtons.Right)
    {
        if (this.radChartView1.ShowTrackBall)
        {
            this.radChartView1.ShowTrackBall = false;
        }
        else
        {
            this.radChartView1.Controllers.Add(new MyTrackballController());
        }
    }
}
I have also updated your Telerik points for bringing this issue to our attention.

I hope this will help. Feel free to write back with any further questions.

Kind regards,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Join us for a FREE webinar to see all the new stuff in action.

Interested, but can’t attend? Register anyway and we’ll send you the recording.
Tags
ChartView
Asked by
scott
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Share this question
or