Page 1 of 1
Detecting Keypress on chart
Posted: Wed Jan 14, 2004 11:45 am
by 9079970
There is no Keypress or Keydown events for TChart objects and the keypress events on the form do not fire when there is a TChart object active.
How can I capture keyboard events?
Posted: Wed Jan 14, 2004 1:48 pm
by Pep
Hi Simon,
>How can I capture keyboard events?
To capture the keyboard events you can put a Command Button on a VB form, covering it with a TeeChart AX Control and then add similar code to the following (this will allow to remove the Series using the "delete" key) :
Code: Select all
Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDelete Then
TChart1.RemoveSeries 2
End If
End Sub
Private Sub Form_Load()
With TChart1
.Aspect.View3D = False
For i = 0 To 5
.AddSeries scLine
.Series(i).FillSampleValues 20
Next i
.Series(2).asLine.Pointer.Visible = True
End With
End Sub
Private Sub TChart1_OnAfterDraw()
Command1.SetFocus
End Sub