onKeyDown and window::defaultKeyDownHandling
Posted: 30 Apr 2019 17:02
I cant seem to capture a "onKeyDown" event.
I contstruct a simle form called "keyDown", that has both a "setKeyDownResponder" and a "setCharResponder"
I expect the predicate "onKeyDown" to be triggered on any key push when the window is active, in focus. Even in debug, it is never triggered.
The onChar predicate does behave as expected and write the Char to the message window.
What am I missing?
thanks in advance
Dave
I contstruct a simle form called "keyDown", that has both a "setKeyDownResponder" and a "setCharResponder"
Code: Select all
implement keyDown inherits formWindow
open core, vpiDomains
clauses
display(Parent) = Form :-
Form = new(Parent),
Form:show().
clauses
new(Parent) :-
formWindow::new(Parent),
generatedInitialize().
predicates
onKeyDown : window::keyDownResponder.
clauses
onKeyDown(_Source, Key, _ShiftControlAlt) = window::defaultKeyDownHandling :-
stdio::write("\n", Key),
!.
predicates
onChar : window::charResponder.
clauses
onChar(_Source, Char, _ShiftControlAlt) = window::defaultCharHandling :-
stdio::write("\n", Char),
!.
% This code is maintained automatically, do not update it manually.
% 11:49:42-30.4.2019
predicates
generatedInitialize : ().
clauses
generatedInitialize() :-
setText("keyDown"),
setRect(rct(50, 40, 290, 160)),
setState([wsf_ClipSiblings, wsf_ClipChildren]),
menuSet(noMenu),
setCharResponder(onChar),
setKeyDownResponder(onKeyDown).
% end of automatic code
end implement keyDown
The onChar predicate does behave as expected and write the Char to the message window.
What am I missing?
thanks in advance
Dave