dialog field

Hi All,

Is it possible to modify dialog field while I am changing the other dialog field value accordingly.

I have created a dialog by class. It contain two fields custId & custName. what I want is, when I change the custId Field value on dialog, then accordingly the custName field should modified.

Plz help.

Thanks

Nitish Kr Gupta

HI Nitish,

To provide a better solution for this , you create a look up in your custId field and override the modified method of the look up

after which according to me your problem may get resolved.

Hi Lalit,

can u please explain in detail plesse.

Thanks

Nitish

Hi Nitish,

Its possible. First you should know the name of the custId dialog field. You can do so by adding the following code to the bottom of your dialog method.

info (custId.name());//custId is the dialog field

Once you know the dialog field name, you can override its modified method by adding the following method to your class.

void dialogFieldName_modified()//specify the name you get from the info method in place of “dialogFieldName”

{

}

Hope this helps you

Hi Imran,

Thanks for replying.

Can u please explain how to specify logic here. I am not getting it.

I got the custId Field Name by Info its comming like "Fld1_1 ".

Eagerly waiting for ur reply.

Thanks

Nitish

By logic I mean, get the customer name for the selected customer Id and assign it to customer name dialog field here …

your method should look like

void Fld1_1_modified()

{

CustName.value(custTable::find(CustId.value())).Name;

}

Hi Imran,

I did as u suggested, but custName is not showing in dialog field. I also applied debugger on ‘fld1_1_modifid’ method but debugger is not going there.

Here is code I written on modified method.

void Fld1_1_modified()

{;

fieldName.value(custTable::find(fieldAccount.value()).Name);

}

here fieldName & fieldAccount are dialog field name for custName & custAccount respectively.

please suggest what next to do .

Thanks

Nitish

Hi,

try this…

Public boolean fld1_1_modified()
{
FormStringControl control;
boolean isFieldModified;
;
control= dialog.formRun().controlCallingMethod();

isFieldModified = control.modified();

if(isFieldModified)
{

dialogName.value(custTable::find(fieldAccount.value()).Name);

}
return isFieldModified;
}

The modified method can also be accessed by overriding

public void dialogSelectCtrl()
{
}

in the runbase class. Just call

dialog.allowUpdateOnSelectCtrl(true);

in the dialog method.

You can also create a dialog form and pass it as the parameter in the dialog method of runbase class. you can find an example in tutorial_runbase class and form.

Hi Nitish,

In order to achieve dynamic dialog event overloading your dialog class need to extend Runbase class.

In your dialog method add this following code

dialog.allowUpdateOnSelectCtrl(true);

Create a new method

public void dialogSelectCtrl()

{

;

fieldName.value(custTable::find(fieldAccount.value()).Name);

}

No need of Fld1_1_modified() method.

dialogSelectCtrl is a method in Runbase class.

Hope this solves your problem.

Thanks Imran

Its working.

but name in custName is changing after clicking on other control, not immediately after selecting the custId. if u have any idea about it, otherwise it ok.

Many Thanks

Nitish

Hello !

i have the same problem, the value change after clicking on other control :s

do you have a solution ?

thanks a lot

hi,

Just view above in this page and you will gea soln…

Hi Don’t forget to added this method in your class to make the fld1_1_Modified to work properly

public void dialogPostRun(DialogRunbase _dialog)

{

super(_dialog);

_dialog.dialogForm().formRun().controlMethodOverload(true);

_dialog.dialogForm().formRun().controlMethodOverloadObject(this);

}

Using This method is a problem if you want to modify the dialog field name after that it would allow you to change but it would still take the default code written for the account num change.

In scenario where you want to change the Name after it returns it is not possible to use this method

Why I cant get it work? Where is wrong?

1-

class WYCustDialog extends RunBase
{
Dialog dialog;
DialogField fieldCustAcc;
DialogField fieldCustName;

}

2- Pack

3- Unpack

4 -

void CustDialogCreate()
{
;

dialog = new Dialog(“Customer select”);
fieldCustAcc = dialog.addField(typeId(CustAccount));
fieldCustName = dialog.addField(typeid(CustName));

dialog.allowUpdateOnSelectCtrl(true);

dialog.run();

}

5-

public void dialogSelectCtrl()

{

;

fieldCustName.value(custTable::find(fieldCustAcc.value()).Name);

}

6-

public static void main(Args args)
{
WYCustDialog wyCustDialog;
;

wyCustDialog = new WYCustDialog();
wyCustDialog.CustDialogCreate();

}

Finally I found the solution. Post here for refreshing myself and others reference.

- Your class should exten RunBase

class WYCustDialog extends RunBase
{
Dialog dialog;
DialogField fieldCustAcc;
DialogField fieldCustName;

}

- Create a return Object method, must be called as “dialog”, use dialog = super() to instatiate the dialog object

protected Object dialog()
{
;

dialog = super();
fieldCustAcc = dialog.addField(typeId(CustAccount));
fieldCustName = dialog.addField(typeid(CustName));

dialog.allowUpdateOnSelectCtrl(true);

return dialog;

}

- create a void method must be called as "dialogSelectCtrl"

public void dialogSelectCtrl()

{

;

fieldCustName.value(custTable::find(fieldCustAcc.value()).Name);

}

- create main method to run the class object /dialog

public static void main(Args args)
{
WYCustDialog wyCustDialog;
;

wyCustDialog = new WYCustDialog();
if(wyCustDialog.prompt())
{
wyCustDialog.run();
}
}

- Pack Unpack mehtods are required for RunBase class, you might want to override them as:

public container pack()

{

return connull();

}

public boolean unpack(container packedClass)

{

return true;

}