Dynamic ax 2012 Dialog and lookup

1、简单创建Dialog 

static void myDialog(Args _args)
{
    str FromChequeNum="1000"; 
    str NumOfCheque="300";
    Dialog dialog = new Dialog("@SYS23133");
    DialogField dialogAccountId = dialog.addField(
        extendedTypeStr(BankAccount));
    DialogField dialogFromChequeNum = dialog.addField(
        extendedTypeStr(ItemId),
        "@SYS4083");
    DialogField dialogNumOfCheque = dialog.addField(
        extendedTypeStr(Qty),
        "@SYS14578");
   
    ;
    dialogAccountId.Value("456");
    dialogAccountId.Active(false);
    dialogFromChequeNum.Value(FromChequeNum);
    dialogNumOfCheque.Value(NumOfCheque);
    if (dialog.run())
    {
        FromChequeNum = dialogFromChequeNum.Value();
        NumOfCheque = dialogNumOfCheque.Value();
    }
}

https://docs.microsoft.com/en-us/dynamicsax-2012/developer/using-classes-to-create-a-dialog


2、dialog创建lookup下拉框

class DialogLookupTest extends RunBase
{
    DialogField                 fieldLookup;
    
}
static void main(Args _args)
{
    
    DialogLookupTest            dialogLookup = new DialogLookupTest();
    
    container       returnIds1;
    if (dialogLookup.prompt())
    {
        dialogLookup.run();
        
    }
    
}
public Object dialog()
{
    Dialog                      dialog;
    FormStringControl           control;
    //DialogField                 fieldLookup;
 
    dialog = super();
 
    // Dialog Title
    dialog.caption("Aif Adapter");
 
    // Field - EDT, Label
    fieldLookup = dialog.addField(extendedTypeStr(AifAdapterName), "AifAdapterName:");
    
 
    // Get control
    control = fieldLookup.control();
 
    // Override lookup method
    control.registerOverrideMethod(methodStr(FormStringControl, lookup), 
                                   methodStr(DialogLookupTest /* Class name */, 
                                             lookup /* Method name*/), this);
 
    return dialog;
}
// Get input values ,Run before closing the window
public boolean getFromDialog()
{

    info(strFmt('%1',fieldLookup.value()));
    
    return true;
}
public void lookup(FormStringControl _control)
{
    Query                   query = new Query();
    QueryBuildDataSource    queryBuildDataSource;
    SysTableLookup          sysTableLookup = SysTableLookup::newParameters(tableNum(AifAdapter), 
                                                                           _control);
 
    // Create lookup for AifAdapter's Name and AdapterClassId
    sysTableLookup.addLookupField(fieldNum(AifAdapter, Name));
    sysTableLookup.addLookupField(fieldNum(AifAdapter, AdapterClassId));
 
    // Setup query
    queryBuildDataSource = query.addDataSource(tableNum(AifAdapter));
    sysTableLookup.parmQuery(query);
 
    // Perform lookup
    sysTableLookup.performFormLookup();
}

https://ztirom.at/2015/12/ax2012-dialog-custom-lookup/


3、Tutorial_LookupMultiSelectDialog


4、其他格式待续。。。NVT_ProjSchedultTaskCreate

 dlgCreateType   = dialog.addFieldValue(enumStr(NVT_ProjTaskCreateType),createType);
    dlgCreateType.value(NVT_ProjTaskCreateType::BehindTask);

    dlgTask         = dialog.addFieldValue(extendedTypeStr(NVT_ProjTaskId),taskId);

    dlgStartDate    = dialog.addFieldValue(extendedTypeStr(StartDate),startDate);
    dlgStartDate.value(NVT_ProjTaskLine::addDayNoWeekend(systemDateGet()));

    dlgDueDate      = dialog.addFieldValue(extendedTypeStr(DueDate),dueDate);
    dlgDueDate.value(NVT_ProjTaskLine::addDayNoWeekend(systemDateGet()));

    dlgMainTask     = new DialogField(dialog,extendedTypeStr(NVT_ProjTaskMain),#dlgMainTaskFieldNo);
    dialog.addCtrlDialogField(dlgMainTask.name());
    dlgMainTask.init(dialog);
    dlgMainTask.label("@TEK391");
    dlgMainTask.helpText("@TEK391");




    Danzel
    Danzel管理员

    • 声明:本文由Danzel于2020-12-09转载(优化),转载须经原站同意并注明出处。
    • 本文地址:http://maryd.cn/?id=143
    上一篇:Dynamic ax 2012弹出框Message Box
    下一篇:Dynamics AX Error:Number sequence Tran has been exceeded

    留言评论

    暂无留言
    取消
    扫码支持