I’m having a lot of fun trying to get Client Keystroke Event Scripts to be the entities that capture Left & Right Arrow Key Presses. It seems like almost everything consumes those before the Client Event system gets to them. In my window there is a slider that the operator used to set motor speed. The motor drives a pump and the system controls the flow by opening and closing analog check valves. The Left/Right arrow keys are supposed to control these check valve positions. Unfortunately once the operator adjusts the speed the slider has focus and consumes the arrow button presses.
If the arrow keys are pressed right after the window is loaded they work as desired.
In an effort to figure out what to give focus to after the motor speed was set I added the following code to my internalFrameActivated event script for the window:
from java.awt import KeyboardFocusManager focusedComponent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() print focusedComponent.getName()
After adding this and navigating to the window the console output for the component name was “None”.
At a point I saved, published, updated again while still on this window and the component name was different. It was actually the project name.
So the question, is there a way to set the focus to NOTHING (remove it from all screen components)?
What about setting it to the project itself?