Page 1 of 1

Can I make a TeeListBox serie highlighted without mouse clk

Posted: Mon Jan 12, 2009 9:32 am
by 15049572
When using a TeeListBox, and you click the mouse at a serie, it will become highlighted or blue (selected).
Is it posible to make this highlight, when the user e.g. clicks at the graph in the chart. ?

Regards
Kasper

Posted: Mon Jan 12, 2009 10:35 am
by narcis
Hi Kasper,

Yes, you can do something like this:

Code: Select all

Private Sub Form_Load()
    TChart1.AddSeries scLine
    TChart1.AddSeries scLine
    TChart1.AddSeries scLine
    
    TChart1.Series(0).FillSampleValues 10
    TChart1.Series(1).FillSampleValues 10
    TChart1.Series(2).FillSampleValues 10
    
    TeeListBox1.Chart = TChart1
End Sub

Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    TeeListBox1.SelectedSeries = SeriesIndex
    TeeListBox1.Repaint
End Sub
However I noticed that when setting new SelectedSeries, previously selected series doesn't unselect and added this issue (TV52013711) to the list to be fixed for future releases.

Posted: Mon Jan 12, 2009 11:48 am
by 15049572
Ok, I have forgotten the repaint method.. Yes it does not deselect the selection clicked by the mouse. Looking forward to a new release :wink:

Posted: Tue Jan 20, 2009 9:21 am
by narcis
Hi Kasper,

I've found that TV52013711 is not a bug as MultiSelect property exists in the VCL version and solves that problem:

Code: Select all

  ChartListBox1.MultiSelect:=false;
Notice that TeeChart Pro v8 ActiveX is a COM wrapper of TeeChart Pro v8 VCL.

However, I've also found that this property doesn't exist in the ActiveX version so I've added this issue (TA05013760) to the TeeChart Pro v8 ActiveX list to be implemented for next releases.

Posted: Thu Feb 19, 2009 9:38 am
by narcis
Hi Kasper,

We found that MutiSelect property is not neceessary here. Using code below you can select multiple items in the ChartListBox pressing Shift+Left button or selecting a series in the chart which would be highlighted in the ChartListBox.

Code: Select all

Private Sub Form_Load()
    TChart1.AddSeries scLine
    TChart1.AddSeries scLine
    TChart1.AddSeries scLine
    TChart1.Series(0).FillSampleValues 10
    TChart1.Series(1).FillSampleValues 10
    TChart1.Series(2).FillSampleValues 10
    TeeListBox1.Chart = TChart1
End Sub

Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    With TeeListBox1
        .SetFocus
        .SelectedSeries = SeriesIndex
        .UpdateSeries
    End With
End Sub