Generating
a Dialog Form Using RunBase Class
Requirement
* Create a Dialog form using Dialog Class with 2 fields “AccountNumber ” and “CustName”
*AccountNumber” field should enable Customer
lookup(can use existing EDT) and whenever selecting a purticular customer
,the CustomerName should automatically displayed in “CustName”
field.
Step1:
Create a New class which extends the Runbase class
…..mandatory
class
Dialogingnew extends
RunBase
{
DialogField
CustAccount;
DialogField
CustName;
Dialog
dialog;
}
Step2:
write
dialog()
method in the class
…..mandatory
protected
Object dialog()
{
dialog=
super();
dialog.allowUpdateOnSelectCtrl(true);
CustAccount
= dialog.addField(extendedTypeStr(CustAccount),"
AccountNumber");
CustName
= dialog.addField(extendedTypeStr(Name),"CustName");
return
dialog;
}
Step3:
Write
dialogpostRun() method
public
void dialogPostRun(DialogRunbase
newdialog)
{
super(newdialog);
newdialog.dialogForm().formRun().controlMethodOverload(true);
newdialog.dialogForm().formRun().controlMethodOverloadObject(this);
}
Step4:
Write
the user defined method called fld1_1_modified()
public
boolean fld1_1_modified()
{
FormStringControl
control = dialog.formRun().controlCallingMethod();
boolean
isFieldModified;
isFieldModified
= control.modified();
if(isFieldModified)
{
CustName.value(custTable::find(control.text()).name());
}
return
isFieldModified;
}
Step5:
write
pack() and unPack() method …..mandatory
Pack
public
container pack()
{
return
connull();
}
UnPack
public
boolean
unpack(container
packedClass)
{
return
true;
}
Step6:
Write
User defined method “..description..”
static
client
server
ClassDescription description()
{
return
"CustomerId
and Name";
}
Step7:
write
the main() method with object creation for the your class…..mandatory
public
static
void
main(Args args)
{
Dialogingnew
dialoging;
dialoging
= new
Dialogingnew();
if(dialoging.prompt())
{
dialoging.run();
}
}
Now Run the class
and select a particular AccountNumber then the name will be displayed in CustName field
Note:
**There is no override Modified method in class level, so we need to write the user defined Modified method [ fld1_1_modified()].
**For
running this user defined method, we need to write another method
called as dialogpostRun()
**Description() method is to give description for your dialog form.
No comments:
Post a Comment