控制数据源中某一列是否允许编辑 FormDataObject allowEdit
void updateDesign()
{
FormDataObject fldItemName;
// Only allow the item name to be modified if it's a service item
//
// Notice that this effects the controls both on the grid, and on the general tab.
fldItemName = inventTable_DS.object(FieldNum(InventTable,ItemName));
fldItemName.allowEdit(inventTable.ItemType == ItemType::Service);
}
//将所有Field禁止编辑
To prevent editing code when you add fields to the table, call the fieldproperties using the dictionary classes:
void SetFieldsAllowEdit() // 这是数据源中的方法
{
FormDataObject fldItemName;
boolean allowEdit = false; //This would set according to some criteria
SysDictTable dictTable = new SysDictTable(this.table());
FieldId currentFieldId;
;
for (currentFieldId = dictTable.fieldNext(0); currentFieldId; currentFieldId = dictTable.fieldNext(currentFieldId))
{
fldItemName = this.object(currentFieldId);
if (fldItemName)
fldItemName.allowEdit(allowEdit);
}
}