Detecting Keypress on chart

TeeChart for ActiveX, COM and ASP
Post Reply
Simon
Newbie
Newbie
Posts: 9
Joined: Thu Nov 27, 2003 5:00 am
Location: UK
Contact:

Detecting Keypress on chart

Post by Simon » Wed Jan 14, 2004 11:45 am

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?

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Jan 14, 2004 1:48 pm

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

Post Reply