AX 如何處理關閉form的操作

如果不想保存該行就關閉
可以overide這個write 和 valiated write 的函數
只有在close ok 才去validated
其他就不validate

public boolean validateWrite()
{
    boolean ret;

    if(element.closedOk())
        ret = super();
    else
        ret = true;

    return ret;
}

其他:

We had this question asked on one of the internal AX forums, and Michael Fruergaard wrote a short description of each method you can use.

Re-posting it here with some extra comments, so that new developers can read and understand, when to use what method.

There are “only” 5 ways to close a form:
Close - close the form. Similar to the 'X' button.

CloseOK – close the form, and set the OK flag – called by the Commandbutton::Ok

CloseCancel – close the form, and set the Cancel flag – called by the Commandbutton::Cancel

CloseSelectRecord – close the lookup form, and set return record

CloseSelect – close the lookup form, and set return value

The below methods (note their names are in past-tense) are used to determine if or how a form was closed:
Closed – Returns true, if the form is no longer open

ClosedOK – Return true, if the form was closed by the user clicking ‘OK’

ClosedCancel – Returns true, if the form was closed by the user clicking ‘Cancel’

Finally, CanClose() is called before any of the close methods get called. If CanClose() returns false, the form is not allowed to close

?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容