How Does a Dialog works from Class.
Hello,
In this Blog will Explain how Dialog form Class will work will mention about all small details.
1. Create a Class and extends it from RunBase.
2. Declare all the Tables , EDT and Dialog Button that is required in you blog.
Note :- Don't for get to declare dialog.
e.g : -
class "YourClassName" extends RunBasestr Accountnum,CustGroup;
{
DialogField dfCustAccountNum;
DialogField dfCustGroup;
CustTable custtable;
dialog dialog;
#define.currentversion(1)
#LOCALMACRO.CurrentList
dfCustAccountNum,
dfCustGroup
#ENDMACRO
}
3. Now suppose if we have select some particular record on Customer Form and we have to modify some fields of that records or update those record .
e.g link we have to update the customer accountnum and customer group.
for this to be done we need to have that particular record of that table in ARGS.
for this we need to make a paramMethod in dialog Class and has to pass that method in Main method of that class.
Reason : When the Class will be called from Menu button on the form Main method is required so that on form the current selected record can go to ARGS.
here is the example of the Main Method and ParamMethod.
ParamMethod:
CustTable parmCustTable(CustTable _CustTable = CustTable){
;
CustTable = _CustTable;
return CustTable;
}
Main Method :
Static void Main(Args _args)
{
CustTableUpdateMaunally custtableUpdate;
CustTable custtable;
;
custtableUpdate = new CustTableUpdateMaunally();
custtable = _args.record();
custtableUpdate.parmCustTable(custtable);
if(custtableUpdate.prompt())
custtableUpdate.run();
}
Till now what we have done is bring the selected record form the form into our process now if you see
"custtableUpdate.prompt()"
what this does it call Dialog and GetFromDialog Method through Runbase .
e.g of Dialog and GetfromDialog Method.
Object dialog()
{
dialog = super();
Dialog.caption("Label");
dialog.addFieldValue(extendedTypeStr(CustAccount),Custtable.accountnum).enabled(false);
dialog.addFieldValue(extendedTypeStr(CustGroupId),Custtable.Custgroup).enabled(false);
dfCustAccountNum= dialog.addField(extendedTypeStr(CustAccount),"Label");
dfCustGroup= dialog.addField(extendedTypeStr(CustGroupId),"Label");
dfCustAccountNum.value(Custtable.accountnum);
dfCustGroup.value(Custtable.Custgroup);
return Dialog;
}
getFromDialog Method.
public boolean getFromDialog()
{
boolean ret;
;
ret = super();
Accountnum= dfCustAccountNum.valuestr();
CustGroup= dfCustGroup.valuestr();
if(!Accountnum&& !CustGroup)
throw error ("Label");
return ret;
}
After this you can write your logic in RUN Method of Class.
No comments:
Post a Comment