[DE] use component to focus on window open

This commit is contained in:
Maxim Kadushkin 2020-10-21 10:37:42 +03:00
parent 7dce6d79ae
commit dd0359ce90
3 changed files with 20 additions and 7 deletions

View file

@ -143,6 +143,11 @@ Common.UI.FocusManager = new(function() {
updateTabIndexes(true);
}
}
if ( e.getDefaultFocusedComponent )
setTimeout(function(){
e.getDefaultFocusedComponent().focus();
}, 100);
},
'window:show': function(e){
if (e && e.cid && _windows[e.cid] && !_windows[e.cid].fields) {

View file

@ -129,15 +129,19 @@ define([
this.updateMetricUnit();
setTimeout(function(){
me.spnColumns.focus();
}, 100);
// setTimeout(function(){
// me.spnColumns.focus();
// }, 100);
},
getFocusedComponents: function() {
return [this.spnColumns, this.spnSpacing];
},
getDefaultFocusedComponent: function () {
return this.spnColumns;
},
_handleInput: function(state) {
if (this.options.handler) {
this.options.handler.call(this, this, state);

View file

@ -341,6 +341,10 @@ define([
return [this.cmbFormat, this.cmbAlign, this.cmbSize, {cmp: this.levelsList, selector: '.listview'}];
},
getDefaultFocusedComponent: function () {
return this.type > 0 ? this.cmbFormat : this.cmbAlign;
},
afterRender: function() {
this.updateThemeColors();
this._setDefaults(this.props);
@ -357,10 +361,10 @@ define([
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
var me = this;
_.delay(function(){
(me.type>0) ? me.cmbFormat.focus() : me.cmbAlign.focus();
},100);
// var me = this;
// _.delay(function(){
// (me.type>0) ? me.cmbFormat.focus() : me.cmbAlign.focus();
// },100);
},
updateThemeColors: function() {