forked from mbk-lab/rui_orig
2
0
Fork 0

Changed FocusView function

This commit is contained in:
anoshenko 2023-05-07 19:44:28 +03:00
parent 7c0449775c
commit b15305d727
2 changed files with 7 additions and 2 deletions

View File

@ -6,6 +6,7 @@
* Changed the main event listener format for "drop-down-event", "edit-text-changed",
"color-changed", "number-changed", "date-changed", and "time-changed" events.
Old format is "<listener>(<view>, <new value>)", new format is "<listener>(<view>, <new value>, <old value>)"
* Changed FocusView function
* Bug fixing
# v0.12.0

View File

@ -830,9 +830,13 @@ func colorStyledProperty(view View, subviewID []string, tag string, inherit bool
return Color(0)
}
// FocusView sets focus on the specified View, if it can be focused.
// FocusView sets focus on the specified subview, if it can be focused.
// The focused View is the View which will receive keyboard events by default.
func FocusView(view View) {
// If the second argument (subviewID) is not specified or it is "" then focus is set on the first argument (view)
func FocusView(view View, subviewID ...string) {
if len(subviewID) > 0 && subviewID[0] != "" {
view = ViewByID(view, subviewID[0])
}
if view != nil {
view.Session().callFunc("focus", view.htmlID())
}