Page 1 of 1

ChartListBox event to detect if any item have been moved

Posted: Tue Aug 19, 2014 10:13 am
by 15654539
It is possible to move items draging them in the chartlistbox. Is there any event to detect when it is done?

Thanks

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

Posted: Wed Aug 20, 2014 9:53 am
by 10050769
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,

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

Posted: Wed Aug 20, 2014 10:59 am
by 15654539
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

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

Posted: Thu Aug 21, 2014 3:01 pm
by 10050769
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,