Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
254 views
in Technique[技术] by (71.8m points)

axapta - gotFocus and enter methods on Form field not being called

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...