fix: Register keypressScene after setScene (closes #143)

keypressScene() sets the handler for the CURRENT scene, so we must
call setScene() first to make focus_demo the active scene before
registering the key handler.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John McCardle 2025-12-28 15:35:48 -05:00
commit 85e90088d5

View file

@ -751,17 +751,15 @@ def create_demo_scene():
else:
status_text.text = "No widget focused"
# Register key handler using Scene API
scene = mcrfpy.sceneUI("focus_demo")
# Note: We use keypressScene for function-based handler since we're not subclassing Scene
# Activate scene first (keypressScene sets handler for CURRENT scene)
mcrfpy.setScene("focus_demo")
# Register key handler for the now-current scene
mcrfpy.keypressScene(on_key)
# Set initial focus
focus_mgr.focus(0)
# Activate scene
mcrfpy.setScene("focus_demo")
return demo_state