Page 1 of 1

Intercepting the "Add" button on TEditor.

Posted: Tue Mar 24, 2009 6:54 pm
by 9530487
Hello all,

I use TChart in some of my software. There is one thing I cannot work out if I can do or not.

What I want to do is have the end user click the "Add" button on the Editor dialog, select the chart type they want, and then let me display a dialog so that the user can select one of a set of pre-defined series titles. Once they click OK to select the series title, I can then squirt in the data points.

Does that make sense?

I have searched through everything I can find, and cannot work out if this is possible.

Thanks in advance for any help.

Tony.

Posted: Tue Mar 24, 2009 7:21 pm
by 9530487
Note : I am still using tchart version 7.

I've just run the tchart 8 demo for the first time, and it seems there is an "OnAddSeries" event.

So it looks like I need to upgrade ASAP.

Tony.

Posted: Wed Mar 25, 2009 9:16 am
by yeray
Hi Tony,

I'm not sure to understand what are you exactly trying to do. I understand that you have a TeeEditor and you want to "do something" when the user adds a series.

I only can think in a solution if you are not allowing the user to remove a series at the same time. You could check if there are more series than before calling TeeEditor1.ShowEditor:

Code: Select all

Private Sub Command1_Click()
Dim OldSeriesNum As Integer
  OldSeriesNum = TChart1.SeriesCount
  TeeEditor1.ShowEditor
  
  If TChart1.SeriesCount > OldSeriesNum Then
    'do what you want
  End If
End Sub
If this is not what are you trying to do, please try to explain the process you are exactly trying to achieve and we'll see if it's still possible with v7.

Posted: Wed Mar 25, 2009 9:25 am
by 9530487
Don't worry. I've already upgraded to version 8 and I can do what I need to using that.

But to clarify, I have some GUI building software. In the background, there are a series of pre-defined time series (I have the time series name and values). So what I wanted to do was have the user add a series, and then let them select which time series they want to display on that series.

I wanted the user to click "Add" and select the series type, then instead of having the name "Series0", I wanted to show them a dialog and let them select from a drop down box. I can do this using V8 by intercepting the "OnAddSeries" function (I can display my dialog, if the user clicks OK, I modify the newly added series, if they click cancel, I can just remove it).

Tony.