Page 1 of 1
teecommander click event - which button clicked & the st
Posted: Thu Nov 06, 2008 5:48 pm
by 10050727
When the teecommander toolbar click event is activated, how can I tell which toolbar button was clicked, and what the state of that button is. For example, I want to know when the 3D button is enabled/disabled so that I can change some charting attributes (e.g. line thickness) depending on the new state of the button.
I decided to test this callback, and it is not called when I click on the toolbar in my application. Is there something I have to do to enable the callbacks?
I would also like to know whether the Click event is handled before or after the chart attributes are updated. For example, when the View3D attribute is changed by the toolbar, is the event handler called before or after the attribute is updated. If after, then I can preserve the 3D attribute state in my own class member, and test for a change in the event handler.
Thanks,
kent
Posted: Mon Nov 10, 2008 1:52 pm
by narcis
Hi Kent,
TeeCommander doesn't have such events. However, you can create your our commander with the events you want. I'll send you an example on how commander's features are implemented using standard buttons.
teecommander click event
Posted: Mon Nov 10, 2008 6:00 pm
by 10050727
I should have mentioned that I am developing with the Delphi version of TeeChart. I think the example you sent was for Visual Basic. I tried to open it in Visual Studio 2005, but the example cannot be upgraded and I do not have a .net version of Teechart, so there is no way I can look at it.
It seems strange that the teecommander toolbar has a click event that isn't implemented. It would be useful if it were implemented. Having to build a custom toolbar in order to get around this limitation is unfortunate.
I hope you have a Delphi example of how to do it.
Thanks,
Kent
Posted: Tue Nov 11, 2008 8:14 am
by narcis
Hi Kent,
In that case we would appreciate if you posted your next technical inquiries at the
TeeChart VCL forum.
Below you'll find example's code. You shouldn't have much problems converting it to Delphi.
Code: Select all
Dim RotateChart, MoveChart, ZoomChart, DChart, Go As Boolean
Dim StartX, StartY As Double
Private Sub Command1_Click()
RotateChart = True
MoveChart = False
ZoomChart = False
DChart = False
End Sub
Private Sub Command2_Click()
With TChart1
.Aspect.Orthogonal = True
End With
With TChart1
.Aspect.HorizOffset = 0
.Aspect.VertOffset = 0
End With
With TChart1
.Aspect.Zoom = 100
End With
With TChart1
.Aspect.Chart3DPercent = 15
End With
MoveChart = False
RotateChart = False
ZoomChart = False
Go = False
End Sub
Private Sub Command3_Click()
MoveChart = True
RotateChart = False
ZoomChart = False
DChart = False
End Sub
Private Sub Command4_Click()
ZoomChart = True
MoveChart = False
Rotate = False
DChart = False
End Sub
Private Sub Command5_Click()
DChart = True
ZoomChart = False
MoveChart = False
Rotate = False
End Sub
Private Sub Command6_Click()
TChart1.ShowEditor
End Sub
Private Sub Form_Load()
Command1.Caption = "Rotate"
Command2.Caption = "Reset"
Command3.Caption = "Move"
Command4.Caption = "Zoom"
Command5.Caption = "3D%"
Command6.Caption = "Editor"
With TChart1
.AddSeries scLine
.Series(0).FillSampleValues 20
.Zoom.Enable = False
.Scroll.Enable = pmNone
End With
End Sub
Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
If RotateChart = True Then
Go = True
StartX = X
StartY = Y
End If
If MoveChart = True Then
Go = True
StartX = X
StartY = Y
End If
If ZoomChart = True Then
Go = True
StartX = X
StartY = Y
End If
If DChart = True Then
Go = True
StartX = X
StartY = Y
End If
End Sub
Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
If RotateChart = True And Go = True Then
With TChart1
.Aspect.Orthogonal = False
.Aspect.Elevation = StartX - X
.Aspect.Rotation = StartY - Y
End With
End If
If MoveChart = True And Go = True Then
With TChart1
.Aspect.HorizOffset = StartX - X
.Aspect.VertOffset = StartY - Y
End With
End If
If ZoomChart = True And Go = True Then
With TChart1
.Aspect.Zoom = StartX - X
.Aspect.Zoom = StartY - Y
End With
End If
If DChart = True And Go = True Then
With TChart1
If (StartX - X) < 101 And (StartX - X) > 0 Then
.Aspect.Chart3DPercent = StartX - X
Else
If (StartX - X) > 101 Then
.Aspect.Chart3DPercent = 100
Else
.Aspect.Chart3DPercent = 1
End If
End If
End With
End If
End Sub
Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
If RotateChart = True Then
With TChart1
.Aspect.Orthogonal = False
.Aspect.Elevation = StartX - X
.Aspect.Rotation = StartY - Y
End With
Go = False
End If
If MoveChart = True Then
With TChart1
.Aspect.HorizOffset = StartX - X
.Aspect.VertOffset = StartY - Y
End With
Go = False
End If
If ZoomChart = True Then
With TChart1
.Aspect.Zoom = StartX - X
.Aspect.Zoom = StartY - Y
End With
Go = False
End If
If DChart = True Then
With TChart1
If (StartX - X) < 101 And (StartX - X) > 0 Then
.Aspect.Chart3DPercent = StartX - X
Else
If (StartX - X) > 101 Then
.Aspect.Chart3DPercent = 100
Else
.Aspect.Chart3DPercent = 1
End If
End If
End With
Go = False
End If
End Sub