2

我的对话框也有类似的问题,但是没有控制调用方法出现错误。

我正在尝试覆盖对 CustAccount 类型的对话框字段的查找 - 我想要的是查找以返回 invoiceAccount 具有特定值的所有 custTable 记录。

这是我的代码:

class AG_UpdateQuoteCust extends Runbase
{
DialogField                 dlgCust;
CustAccount                 newCust;
CustAccount                 custAccount;

#define.CurrentVersion(1)
#define.Version1(1)
#localmacro.CurrentList
    custAccount
#endmacro
}


public Object dialog()
{

DialogRunbase      dlg;
;

dlg = super(dlg);

dlg.caption("Change quotation customer account");


dlg.addText('Please select an alternative customer account');

dlgCust     = dlg.addField(typeid(CustAccount),'Customer account');

dlgCust.fieldControl().mandatory(true);

if(!dlgCust)
{
    error('Please fill out all mandatory fields');
}

return dlg;
}

void Fld2_1_lookup()
{
    Dialog                  dlg = this.dialog();
    SysTableLookup          sysTableLookup;
    QueryBuildDataSource    queryBuildDataSource;
    QueryBuildRange         queryBuildRange;
    Query                   query;
    Str                     TmpStr;
    Formrun                 fr = this.dialogModify().parmDialog();
    Object                  Control = fr.controlCallingMethod();


    FormStringControl              _control = control;
    ;

    sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable),_control);

    sysTableLookup.addLookupfield(fieldnum(CustTable, AccountNum),true);
    sysTableLookup.addLookupfield(fieldnum(CustTable, Name));
    sysTableLookup.addLookupfield(fieldnum(CustTable, NameAlias));

    query = new Query();

    queryBuildDataSource = query.addDataSource(tablenum(CustTable));

    tmpStr = 'ADAM001H';

    queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, InvoiceAccount));
    queryBuildRange.value(TmpStr);


    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();
}

public void dialogPostRun(DialogRunbase dialog)
{

;

Super(dialog);
dialog.formRun().controlMethodOverload(true);
dialog.formRun().controlMethodOverloadObject(this);
}

你能告诉我我哪里出错了 - 事实上,我并不真正理解 dialogPostRun 方法的这种覆盖或 ControlCallingMethod 的使用。

4

1 回答 1

2

尝试DialogRunbase dlg;从方法移动dialogClassDeclaration,删除Dialog dlg = this.dialog();和使用Object control = dlg.formRun().controlCallingMethod();方法fld2_1_lookup。它应该工作。

于 2012-11-09T01:09:32.407 回答