0

I Have created a dialog in a class, the dialog method is as below

static void dialog(Args _args)
{
Dialog              dialog;
DialogField         dialogFieldCurrentState;
DialogField         dialogFieldNewState;
CustInvoiceTable    custInvoiceTable;


;

custInvoiceTable = _args.record();



dialog                  = new Dialog("Change State");
dialogFieldCurrentState = dialog.addField(TypeID(State_LT),"Current State: ");
dialogFieldCurrentState.value(custInvoiceTable.State);
dialogFieldCurrentState.enabled(false);
dialogFieldNewState     = dialog.addField(TypeID(State_LT),"New State: ");

if (dialog.run())
{
    custInvoiceTable.State =  dialogFieldNewState.value();

}

}

in my dialog there are two fileds Current State and New State .Now when i select the New State the list of all states is displayed(irrespective of country) which i dont want. Only the states respective of country has to be shown in the lookup . I need to make use of a filter something like e.g. while select while select AddressState where addressState.CountryRegionId == custInvoiceTable.CountryRegionId; so that only states which are related to a country is shown.

State_LT here is an string EDT (where i put in the relation of State_LT) State_LT == AddressState.StateId

IN AdressState there is a method lookupStateId(), How to call it from a dialog(code above) ?

4

2 回答 2

4

我正在回答您的最后一个问题:“在 AdressState 中有一个方法 lookupStateId(),如何从对话框中调用它(上面的代码)?” - 顺便说一句,用大写字母书写并不能帮助人们更好地理解你的观点。

目前尚不清楚为什么您dialog的方法是静态方法,无论如何您需要以下内容。

假设您的 ClassDeclaration 看起来像这样:

class TestClass1 extends RunBase
{
    Dialog      dialog;
    DialogField dialogFieldCurrentState;
    DialogField dialogFieldNewState;
    // etcetera
}

dialog是这样的:

public Object dialog()
{
    ;

    dialog = super();

    dialogFieldCurrentState = dialog.addField(TypeID(AddressStateId),"Current State: ");
    dialogFieldCurrentState.enabled(false);
    dialogFieldNewState     = dialog.addField(TypeID(AddressStateId),"New State: ");
    dialogFieldNewState.lookupButton(FormLookupButton::Always);     // If needed

    return dialog;
}

要以您想要的方式实现查找,您需要做两件事。首先,打开对话框,右键单击New State,单击Setup,然后检查控件的System Name。例如,如果它是Fld2_1,那么您需要创建以下方法:

void fld2_1_lookup()
{
    Object control = dialog.formRun().controlCallingMethod();
    ;

    AddressState::lookupStateId(control, dialogFieldNewState.value());
}

其次,需要重写以下方法:

public void dialogPostRun(DialogRunbase _dialog)
{
    super(_dialog);

    _dialog.dialogForm().formRun().controlMethodOverload(true);
    _dialog.dialogForm().formRun().controlMethodOverloadObject(this);
}

这应该够了吧。我有一段时间没有这样做了,但我不认为我忘记了什么。

于 2011-04-14T09:50:23.077 回答
0

在对话中查找客户的示例:

例如,在对话框中有一个客户选择下拉菜单,

  • 在报表类声明方法中--->

    DialogField CustomerDlg; CustAccount 客户;

    • 在报告对话框方法中:----->

    dialog.addGroup("客户"); CustomerDlg = dialog.addField(typeid(CustAccount)); CustomerDlg.value(客户);

    • 在 getFromDialog 方法中:---->

    ... 客户 = CustomerDlg.value();

于 2011-04-14T12:44:55.740 回答