10938 : The problem I have found is that my OnTimeItemAreaKeyDown event is not firing correctly…

Question

I have been using GTP.Net for a long time now in one of my apps. I just recently added the feature to move next or previous in the timeitems on the screen.

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

The problem I have found is that my OnTimeItemAreaKeyDown event is firing correctly, but only when I use my numeric pad left (4) or right (6).

 

If I use the regular left and right keys on my keyboard, the control does not seem to pick up the event has fired.

 

I have other controls on my form and they receive the left and right keys, but my GTP doesn’t.

 

Is there something I need to enable to make the left and right keys work?

Answer

I am not sure why some of your keys are working, I would have guessed that all or nothing should apply.

The main “GotYou” thing about catching keys in the time item area is to focus the time item area for key-input.

Implement a MouseDownEvent:

private void gantt1_OnTimeItemAreaMouseDown(object sender, MouseEventArgs e)
{
  gantt1.TimeItemArea.Focus();
}

Try again, this will now work as expected:

private void gantt1_OnTimeItemAreaKeyDown(object sender, KeyEventArgs e)
{
  label1.Text =
“DOWN “ + e.KeyValue.ToString();
}

 

Leave a Reply