Added focus event, elements can request focus

This commit is contained in:
2021-02-11 09:31:44 -06:00
parent e9d75d17bf
commit 76eb1a85d5
3 changed files with 44 additions and 0 deletions

View File

@@ -212,6 +212,16 @@ module CyberarmEngine
:handled
end
def focus(sender)
@focus = true
@style.background_canvas.background = default(:active, :background)
@text.color = default(:active, :color)
window.text_input = @text_input
@text_input.caret_pos = @text_input.selection_start = @text_input.text.length
:handled
end
def blur(_sender)
@focus = false
@style.background_canvas.background = default(:background)