Here I will be explaining, how to create buttons run time and override the clicked method.
We would be creating buttons run time based on the setup companies in some custom table, Like I have table called 'DemoCompanyList' and that table has 3 companies setup
1. USMF
2. USMG
3. IND
Lets create a form and give a name 'DemoRunTimeControl' and then we can apply the pattern based on our requirement and then add Action Pane - Button Group - Menu Button(control name - ButtonHeaderInquiry), change the AutoDeclaration property to 'Yes' for this control.
init() - To get the list of companies and call method addRunTimeButtons()
addRunTimeButton() - In this method we will add buttons to menu button and also register the clicked method so that when we click on those buttons, it should the written clicked method.
RunTimeButton_clicked() - In this method we will opening the custInvoiceJour menu item based on the clicked button.
[Form]
public class DemoRunTimeControl extends FormRun
{
Map buttonCompany;
public void init()
{
container companies;
counter i;
super();
buttonCompany = new Map(Types::Integer, Types::String);
companies = DemoCompanyList::findCompanyList(); // Find company list will return the list of the companies
for (i = 1; i <= conLen(companies); i++)
{
element.addRunTimeButton(conPeek(companies, i)); //addRunTimeButtons will add buttons based on the company setup
}
}
private void addRunTimeButtons(DataAreaId _dataAreaId = #emptyString)
{
FormButtonControl runTimeControl;
#define.runTimeCtrl ('DemoRunTimeButton')
runTimeControl = ButtonHeaderInquiry.addControl(FormControlType::Button, #runTimeCtrl + _dataAreaId);
//Invoice (%1)
runTimeControl.text(strfmt("Customer Invoice (%1)", _dataAreaId));
runTimeControl.registerOverrideMethod(methodStr(FormButtonControl, clicked), formMethodStr(DemoRunTimeControl, 'RunTimeButton_clicked'), element);
buttonCompany.insert(runTimeControl.id(), _dataAreaId);
}
public void RunTimeButton_clicked(FormButtonControl _formButtonControl)
{
//Set the local control to the actual control that is calling the method.
_formButtonControl = this.controlCallingMethod();
CompanyId company;
company = buttonCompany.lookup(_formButtonControl.id());
if (company)
{
changecompany (company)
{
//Open invoice journal in specific company
new MenuFunction(MenuItemDisplayStr(CustInvoiceJour),MenuItemType::Display).run();
}
}
}
}
When you will click on first button, system will open customer invoice journals form in USMF company and the same way if you click on IND one, system will open journals from IND company.
We would be creating buttons run time based on the setup companies in some custom table, Like I have table called 'DemoCompanyList' and that table has 3 companies setup
1. USMF
2. USMG
3. IND
Lets create a form and give a name 'DemoRunTimeControl' and then we can apply the pattern based on our requirement and then add Action Pane - Button Group - Menu Button(control name - ButtonHeaderInquiry), change the AutoDeclaration property to 'Yes' for this control.
Form Methods -
init() - To get the list of companies and call method addRunTimeButtons()
addRunTimeButton() - In this method we will add buttons to menu button and also register the clicked method so that when we click on those buttons, it should the written clicked method.
RunTimeButton_clicked() - In this method we will opening the custInvoiceJour menu item based on the clicked button.
[Form]
public class DemoRunTimeControl extends FormRun
{
Map buttonCompany;
public void init()
{
container companies;
counter i;
super();
buttonCompany = new Map(Types::Integer, Types::String);
companies = DemoCompanyList::findCompanyList(); // Find company list will return the list of the companies
for (i = 1; i <= conLen(companies); i++)
{
element.addRunTimeButton(conPeek(companies, i)); //addRunTimeButtons will add buttons based on the company setup
}
}
private void addRunTimeButtons(DataAreaId _dataAreaId = #emptyString)
{
FormButtonControl runTimeControl;
#define.runTimeCtrl ('DemoRunTimeButton')
runTimeControl = ButtonHeaderInquiry.addControl(FormControlType::Button, #runTimeCtrl + _dataAreaId);
//Invoice (%1)
runTimeControl.text(strfmt("Customer Invoice (%1)", _dataAreaId));
runTimeControl.registerOverrideMethod(methodStr(FormButtonControl, clicked), formMethodStr(DemoRunTimeControl, 'RunTimeButton_clicked'), element);
buttonCompany.insert(runTimeControl.id(), _dataAreaId);
}
public void RunTimeButton_clicked(FormButtonControl _formButtonControl)
{
//Set the local control to the actual control that is calling the method.
_formButtonControl = this.controlCallingMethod();
CompanyId company;
company = buttonCompany.lookup(_formButtonControl.id());
if (company)
{
changecompany (company)
{
//Open invoice journal in specific company
new MenuFunction(MenuItemDisplayStr(CustInvoiceJour),MenuItemType::Display).run();
}
}
}
}
I was diagnosed as HEPATITIS B carrier in 2013 with fibrosis of the
ReplyDeleteliver already present. I started on antiviral medications which
reduced the viral load initially. After a couple of years the virus
became resistant. I started on HEPATITIS B Herbal treatment from
ULTIMATE LIFE CLINIC (www.ultimatelifeclinic.com) in March, 2020. Their
treatment totally reversed the virus. I did another blood test after
the 6 months long treatment and tested negative to the virus. Amazing
treatment! This treatment is a breakthrough for all HBV carriers.
My name is Olisa Blessing, I am so happy. I never believe I will be this happy again in life. I have worked as an air hostess ( cabin crew ) for 3years but early this year, I lost my job because of this deadly disease called Herpes virus (HSV). I never felt sick or notice any symptoms. Not until the day all workers were asked to bring their doctors report card, that was how I got tested and I found out that I'm HSV positive and that made me lose my job because it was considered as an STD and is an incurable disease. I was so depressed that I started thinking of suicide.
ReplyDeleteI explained my situation to an older friend of mine, who often said to me 'a problem shared is a problem half solved. She felt so pity for me that she referred me to Dr. Utu Herbal Cure, that was how I contacted Dr. Utu and got the medication from him and was cured for real.
I went back to my work a month later with another HSV negative test result and they carried out another test to be very sure and they found out I am herpes negative.
Finally, the initial result was replaced with the new HSV negative test results and my position was redeemed to me with an apology letter and a salary increase.
Beware of impersonators,
Dr. Utu can only be reached at:
drutuherbalcure@gmail.com
I’d recommend using Dr. Utu Herbal Cure topically for instant pain and itch relief as well as accelerated healing of lesions and permanently stopping oral and genital herpes virus outbreaks. I have tried just about everything from acyclovir suppressive therapy to different natural oils, extracts, and other natural methods, some of which are EXTREMELY painful and exacerbate the problem (i.e. apple cider vinegar!). While vitamin E oil and suppressive therapy worked well for me, when I became pregnant I went back to trying to find a herbal cure. I was using vitamin E oil topically for a while but it was thin and difficult to use and only seemed to prevent further outbreaks rather than getting rid of it. I contacted Dr. Utu Herbal Cure through my friend. To my surprise, I could tell my outbreak was starting to heal within only a few hours! No more itching or pain! Dr. Utu Herbal Cure that I used was liquid herbs in bottles, so it was very easy to use. It simply whiffs, but it works so I don’t care! The best part is I successfully delivered a herpes-free beautiful daughter without further medication. Anyone who’s tried Dr. Utu Herbal Cure knows just how quickly those treatments can add up. So give it a try! Anyone can get Dr. Utu through drutuherbalcure@gmail.com
ReplyDelete+2349072733661