In a small Root GUI application I’m writing, I want to grab and inspect KeyPress events. After some searching effort, I managed to find the basic solution in the Root Talk archives. In particular, the attachment test1.h shows a greatly simplified version of what I’ve done. It works just fine if I compile with ACLiC and run from the Root Interpreter:
root  .L test1.h+
Info in TUnixSystem::ACLiC: creating shared library /home/krlynch/temp/root/keypressed/./test1_h.so
root  new TestFrame(gClient->GetRoot(), 100, 100)
I get my window, and regardless of how I interact with it (moving, clicking on various subwidgets, etc), all the KeyPress events I send it print out just fine, and hitting Escape closes the window, as desired.
I run into a problem when I include a TRootEmbeddedCanvas (see attachment test2.h). As soon as I move the mouse into the Canvas area, KeyPress events no longer print out until I move to some non-Canvas part of the window. In the example, I’ve even tried to Connect the relevant signals and slots for the Canvas and my simple class, but that doesn’t seem to work the way I was expecting. I get no complaints from the system about missing slots or signals, as happens when I screw up a Connect call (which is fairly often :-). It seems the Signals and Slots and member functions I call all exist, but they’re not communicating in the way I expected.
I suspect I am missing something crucial. Can anyone see what I am doing wrong here? Does the TRootEmbeddedCanvas widget not support what I’m trying to do? Any pointers would be appreciated.