setFocusOne method
dynamic
setFocusOne(
- dynamic name,
- dynamic colId,
- dynamic id,
- dynamic isForm,
- dynamic context,
- dynamic selection,
Implementation
setFocusOne(name, colId, id, isForm, context, selection) {
myLog(
'setFocus name:$name,colId:$colId,id:$id,isForm: $isForm,selection:$selection');
clearActionBtnMap(name);
var typeOwner = gForm;
if (!isNull(_tableList[name])) {
typeOwner = gTable;
}
if (selection < 0 && !isNull(colId)) {
var value = getValue(name, colId, id)[gValue];
selection = value.toString().length;
}
if (!isNull(colId)) {
setFocusNode({
gType: typeOwner,
gName: name,
gCol: colId,
gId: id,
gIsForm: isForm,
gSelection: selection
}, context);
myNotifyListeners();
return;
}
//如要已有焦点,退出
if (!isNull(_mFocusNode[gType] ?? '')) {
return;
/*if (_mFocusNode[gType] != gForm) {
return;
}
if (!isNull(_mFocusNode[gName] ?? '') && _mFocusNode[gName] != formid) {
return;
}else if()*/
}
if (typeOwner != gForm && !isNull(id)) {
return;
}
//if (typeOwner == gForm) {
if (isNull(_formLists[name])) {
return;
}
Map<dynamic, dynamic> items = _formLists[name]![gItems];
bool findFocus = false;
for (var itemOne in items.entries) {
Map item = itemOne.value;
if (isreadonly(item, name)) {
continue;
}
colId = item[gId];
var value = getValue(name, colId, id)[gValue];
if (isNull(value) && !findFocus) {
setFocusNode(
{gType: typeOwner, gName: name, gCol: colId, gId: id ?? ''},
context);
findFocus = true;
continue;
}
}
}