Do not use the gotFocus
and enter
methods.
Make a datasource method to make the the change:
void setAllowEdit()
{
salesTable_ds.object(fieldnum(SalesTable, Name)).allowEdit(salesTable.SalesType == SalesType::Journal);
}
Call the method from the the active
method:
public int active()
{
int ret = super();
...
this.setAllowEdit()
return ret;
}
Call the method from the datasource field (in this case the SalesType
field):
public void modified()
{
super()
salesTable_ds.setAllowEdit()
element.changeType(); // standard code
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…