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:
|
||||
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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue