Skip to main content
Participating Frequently
March 9, 2016
Question

How to catch keyboard events for treeview widget

  • March 9, 2016
  • 1 reply
  • 492 views

Hello,

I would like to know how to catch keyboard events for a treeview widget (kTreeViewWidgetBoss).

I have added an IID_IEVENTHANDLER to the Class (in the Boss class definitions in the resource file), but

that EH responds only to the LButtonDown event, it does not respond to the KeyDown, KeyCmd, KeyUp events and

I don't understand why... It may be because the widget does not have focus, but I don't know how to set focus to the widget either.

My event handler class inherits from CEventHandler.

I also tried to attach IID_IEVENTHANDLER to the dialog (that contains the treeview) observer, but that does not work either.

So what do I need to do in order to be able to listen to keyboard events from the treeview widget?

Thanks in advance!!

Regards,

Jan

This topic has been closed for replies.

1 reply

Inspiring
March 9, 2016

Hi Jan,

try to add your event handler to the tree node widget not the tree view widget. May be you overwrite an existing event handler, so consider to call the original event handler for some events.

Markus

john_1985Author
Participating Frequently
March 10, 2016

Sorry, I can't get the keyboard events to work with the tree node widget... It does respond to the LButtonDown event.

I disabled my event handler for the treeview widget and now I can focus it again in the UI (clicking on the treeview will add an orange border around it),

Do you have an example?