ChartListBox event to detect if any item have been moved

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

ChartListBox event to detect if any item have been moved

Post by acastro » Tue Aug 19, 2014 10:13 am

It is possible to move items draging them in the chartlistbox. Is there any event to detect when it is done?

Thanks

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: ChartListBox event to detect if any item have been moved

Post by Sandra » Wed Aug 20, 2014 9:53 am

Hello acastor,
It is possible to move items dragging them in the chartlistbox. Is there any event to detect when it is done?
Yes, is possible. In the TeeChart.Net demo project there are some examples demonstrate that, specifically in Welcome !\Components\Chart listbox.. You find the demo project under similar path as next:
%Program Files%Steema Software\Steema TeeChart for .NET 2014 4.1.2014.08120\Examples\DemoProject\bin\ExecutableDemo
Moreover, you can use the simple example below that uses the DragDrop event to detect which item you have dragged.

Code: Select all

        
    public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
       
        Steema.TeeChart.ChartListBox listSeries; 
        private void InitializeChart()
        {
            listSeries = new Steema.TeeChart.ChartListBox();
            this.Controls.Add(listSeries); 
            listSeries.Chart = tChart1; 
            tChart1.Aspect.View3D = false;
            for (int i = 0; i < 4; i++)
            {
                new Steema.TeeChart.Styles.Line(tChart1.Chart); 
                tChart1[i].FillSampleValues(); 
                
            }
            listSeries.DragDrop += listSeries_DragDrop;
        }

        void listSeries_DragDrop(object sender, DragEventArgs e)
        {
            if(listSeries.EnableDragSeries)
            {
               this.Text=  listSeries.Series(listSeries.SelectedIndex).Title; 
            }
        }
Hoping it will help.

Thanks in advance,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: ChartListBox event to detect if any item have been moved

Post by acastro » Wed Aug 20, 2014 10:59 am

Thanks. But if I ask in the dragDrop event for the value of the list by example "lista.Items[0].ToString()" I see the item has not been moved yet. Is there any posterior event where the item is moved?

Thanks

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: ChartListBox event to detect if any item have been moved

Post by Sandra » Thu Aug 21, 2014 3:01 pm

Hello acastor,

In this case, I would like suggest you use the ChartListBox RefresEvent. That returns you the ChartListBox item value after it has been moved. The lines below shows how you can do it.

Code: Select all

        void listSeries_RefreshEvent(object sender, EventArgs e)
        {
            
            if (listSeries.Items.Count != 0)
            {
                this.Text = listSeries.Items[0].ToString();
            }

         }
Hoping it will help.

Thanks in advance,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply