Hi,
I'm working whit the TChart and VbScript, but I have a problem with the
TChart's events.
When I attach the TChart control to the Scrip Object the properties work
correctly, but the events don't trigger in the Script
This is a example
In a VbProjects add a TChart, RichTextBox, TextBox and a CommandButton objects, and add reference to msscript.ocx
Add the next source in a form
Private WithEvents m_scriptEngine As MSScriptControl.ScriptControl
Private Sub Command1_Click()
m_scriptEngine.AddCode Text1
m_scriptEngine.Run "Activate"
m_scriptEngine.State = Connected
End Sub
Private Sub Form_Initialize()
Set m_scriptEngine = New MSScriptControl.ScriptControl
m_scriptEngine.Language = "VBScript"
m_scriptEngine.AllowUI = True
m_scriptEngine.UseSafeSubset = False
m_scriptEngine.SitehWnd = Me.hWnd
End Sub
Private Sub Form_Load()
m_scriptEngine.AddObject "TChart1", TChart1.Object
m_scriptEngine.AddObject "TChart", TChart1
m_scriptEngine.AddObject "RichTextBox1", RichTextBox1.Object
m_scriptEngine.AddObject "RichTextBox", RichTextBox1
Text1 = "Sub Activate" & vbCrLf & _
" msgbox " & """" & "Activate" & """" & vbCrLf & _
" RichTextBox.Text = " & """" & "VbScript Test" & """" & vbCrLf & _
" TChart.Aspect.View3d = False " & vbCrLf & _
"End Sub" & vbCrLf & vbCrLf & _
"Sub TChart1_OnClick()" & vbCrLf & _
" msgbox " & """" & "OnClick" & """" & vbCrLf & _
"End Sub" & vbCrLf & vbCrLf & _
"Private Sub RichTextBox1_Change()" & vbCrLf & _
" msgbox " & """" & "Change" & """" & vbCrLf & _
"End Sub"
End Sub
Regards
Gustavo.
VbScript and Events
Hello again,
I've tried a similar setup in a C++ ATL project, with the same results. In ATL, the first object doing an AtlAdvise (to sink the TeeChart events) works OK, but the second object receives an error code 0x80040202. Looking for it on google groups I found these two posts:
http://groups.google.com/group/borland. ... 374a2fdcea
http://groups.google.com/group/borland. ... 60feb7fcce
They are related to a bug in a Delphi wizard that generates the code to manage the events. That bug makes that the activex controls generated with delphi could only send event notifications to just one destination.
Could it be possible that TeeChart is suffering from this same bug?
Regards,
Gustavo
I've tried a similar setup in a C++ ATL project, with the same results. In ATL, the first object doing an AtlAdvise (to sink the TeeChart events) works OK, but the second object receives an error code 0x80040202. Looking for it on google groups I found these two posts:
http://groups.google.com/group/borland. ... 374a2fdcea
http://groups.google.com/group/borland. ... 60feb7fcce
They are related to a bug in a Delphi wizard that generates the code to manage the events. That bug makes that the activex controls generated with delphi could only send event notifications to just one destination.
Could it be possible that TeeChart is suffering from this same bug?
Regards,
Gustavo