Hello Krzysztof,
from your comment I understood, that you have tried to call the method DriveKeyboardHitting() from Chora code. In such case, this is (usually) not the right approach. DriveKeyboardHitting() is one of few methods intended to be called from the main-loop when keyboard events are received.
The article Main Loop describes the aspects of platform integration. There you see following C code. This code feeds the GUI application with an event generated by the keyboard:
/* ...and provide it to the application. */
if ( cmd != CoreKeyCodeNoKey )
{
/* feed the application with a 'press' and 'release' event */
events |= CoreRoot__DriveKeyboardHitting( rootObject, cmd, 0, 1 );
events |= CoreRoot__DriveKeyboardHitting( rootObject, cmd, 0, 0 );
}
I have understood, that in your application you have never used the keyboard events as described above. All related events were dispatched in another way (e.g. by using notifyobservers?). In such case, you have surely some mechanisms implemented in your application to control the context of the actual interaction. For example, if your application shows an alert dialog, then the mechanisms have to to take care that as long as the alert is visible no other GUI components do react to the keyboard events.
The menu system (to work correctly in such case) has also to respect the actual context. In other words, if you present a sub menu, the superior menu has to 'deactivate' the processing of keyboard events. These mechanisms are not necessary if the keyboard events are dispatched by the DriveKeyboardEvents() method. The Mosaic framework takes care of the event dispatching by following the concept of so-called focus path.
From your answer I also understood, that you have tried to combine the both approaches. Concret you wanted to call DriveKeyboardHitting() from Chora code as reaction to a received keyboard notification. Well, this is possible. In such case, however, you have to call the method in context of the application root object. The caller has to know the root object. Can you implement the code to handle the notification directly within the application root class? Then you could call the method DriveKeyboardHitting() as follows:
// Feed a press and release event for the given key code.
DriveKeyboardHitting( Core::KeyCode.Escape, '\0', true );
DriveKeyboardHitting( Core::KeyCode.Escape, '\0', false );
Best regards
Paul Banach