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:
parent
b6ec0fe7ab
commit
85e90088d5
1 changed files with 4 additions and 6 deletions
|
|
@ -751,17 +751,15 @@ def create_demo_scene():
|
||||||
else:
|
else:
|
||||||
status_text.text = "No widget focused"
|
status_text.text = "No widget focused"
|
||||||
|
|
||||||
# Register key handler using Scene API
|
# Activate scene first (keypressScene sets handler for CURRENT scene)
|
||||||
scene = mcrfpy.sceneUI("focus_demo")
|
mcrfpy.setScene("focus_demo")
|
||||||
# Note: We use keypressScene for function-based handler since we're not subclassing Scene
|
|
||||||
|
# Register key handler for the now-current scene
|
||||||
mcrfpy.keypressScene(on_key)
|
mcrfpy.keypressScene(on_key)
|
||||||
|
|
||||||
# Set initial focus
|
# Set initial focus
|
||||||
focus_mgr.focus(0)
|
focus_mgr.focus(0)
|
||||||
|
|
||||||
# Activate scene
|
|
||||||
mcrfpy.setScene("focus_demo")
|
|
||||||
|
|
||||||
return demo_state
|
return demo_state
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue