gotFocus and enter methods on Form field not being called

假如想象 提交于 2019-12-18 05:58:11

问题


I have some fields in my Sales Order Form (SalesTable) that need to be disabled if another field is set to a specific value. To do this I overrode the enter and the gotFocus methods on the form field (I did both to test it out). The code compiles and doesn't have any issues.

My issue is that neither of these overridden methods are called when I click on a field in the appropriate grid column. What would cause the enter and the gotFocus methods to not be called on a grid field?


回答1:


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
}


来源:https://stackoverflow.com/questions/9295137/gotfocus-and-enter-methods-on-form-field-not-being-called

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!