forked from mbk-lab/rui_orig
Changed FocusView function
This commit is contained in:
parent
7c0449775c
commit
b15305d727
|
@ -6,6 +6,7 @@
|
||||||
* Changed the main event listener format for "drop-down-event", "edit-text-changed",
|
* Changed the main event listener format for "drop-down-event", "edit-text-changed",
|
||||||
"color-changed", "number-changed", "date-changed", and "time-changed" events.
|
"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>)"
|
Old format is "<listener>(<view>, <new value>)", new format is "<listener>(<view>, <new value>, <old value>)"
|
||||||
|
* Changed FocusView function
|
||||||
* Bug fixing
|
* Bug fixing
|
||||||
|
|
||||||
# v0.12.0
|
# v0.12.0
|
||||||
|
|
|
@ -830,9 +830,13 @@ func colorStyledProperty(view View, subviewID []string, tag string, inherit bool
|
||||||
return Color(0)
|
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.
|
// 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 {
|
if view != nil {
|
||||||
view.Session().callFunc("focus", view.htmlID())
|
view.Session().callFunc("focus", view.htmlID())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue