10933 : Why does the GTP.net OnTimeItemAreaKeyDown event neverfire?

< ?xml:namespace prefix = o />Question

 

Why does the GTP.net OnTimeItemAreaKeyDown event never fire?< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

I need detect “< ?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />del” key and delete TimeItemLinks.Select SelectedLink

 

Answer

 

This event only fires if a control has Focus, and default we do not give keyboard focus to the time item area since it takes focus from the grid (this may very well change in the future when we implement key navigation i the time items)

 

The workaround is to give focus to the TimeItemArea in the MouseDown event:

 

   private void gantt1_OnTimeItemAreaMouseDown(object sender, MouseEventArgs e)
    {
      gantt1.TimeItemArea.Focus();
    }
 
    private void gantt1_OnTimeItemAreaKeyDown(object sender, KeyEventArgs e)
    {
      MessageBox.Show(“key down”);

    }