mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-18 22:02:34 +00:00
Added focus event, elements can request focus
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user