How to ignore keypresses so parent gets them?

My behavior tree view panel is a TCastleScrollView . When the mouse is over it, all keyboard input goes to it. So WASD no longer move the map.

Is there a way to have TCastleScrollView to ignore keypresses so that they get handled by the main navigation?

Fixed – TCastleScrollView should not handle AWSD keys anymore. There was a bug: TCastleScrollView was always marking input as “handled” in update always :slight_smile: This was most likely indeed conflicting with AWSD processing by navigations. Fixed in Fix TCastleScrollViewCustom to not capture all keys always · castle-engine/castle-engine@fe85184 · GitHub .

( As usual, the fix will be automatically available in CGE downloads on Download | Castle Game Engine . You can observe the page Comparing snapshot...master · castle-engine/castle-engine · GitHub to know when it happens – when this page no longer contains the commit titled “Fix TCastleScrollViewCustom to not capture all keys always”, it means this commit is part of the released engine. )

Just in case you’d like to also consider other keys:

TCastleScrollView does handle some specific keys: arrows (up, down), page up / page down, home / end (to move the scrollbar). To disable it, you could define a TCastleScrollView descendant that overrides Press and makes sure it returns false (to signal the presses are not handled), regardless of what ancestor is doing (and it’s your decision then whether to call inherited or not). And override Update to set HandleInput := true always. But, you can ignore this paragraph if you only worry about AWSD, this is just fixed.

1 Like

Oh thank you thank you! I didn’t realize it wasn’t working as designed. Currently I don’t care about other keys, but maybe would in the future. The tree editor will be behind-the-scenes, not for players unless they are modding or debugging behavior.

Very nice, that makes moving around with the tree on the screen so much easier. I like that the list takes the scroll wheel to scroll, instead of the map. In other cases where the wheel gets overloaded (like placing a building and I use wheel to rotate the building), I use ctrl key to make the wheel apply to the camera altitude to move it up and down. To accomplish that with the TCastleScrollView sounds like subclass and delegating the events as needed from Press. I already am a subclass so that should be easy.