Tuesday, January 23, 2018

Calling menu item button of form in a class

I want to call a menu item button of the form, from my class.

In a class follow below procedure


// MyFormControllerClass classDeclaration
public class MyFormControllerClass
{
FormFunctionButtonControl formButton;
}
public FormFunctionButtonControl parmFormButton(FormFunctionButtonControl _formButton = formButton)
{
formButton = _formButton;
return formButton;
}
protected void someEventHandler()
{
if (formButton)
{
formButton.clicked();
}
}


To call above class in form init method

// form classDeclaration
public class FormRun extends ObjectRun
{
MyFormControllerClass formController;
}
// form init
public void init()
{
super();
formController = new MyFormControllerClass();
// pass the button reference
formController.parmFormButton(MyFormButtonWithAutoDeclarationYes);
}


Ex: see the class ->  LedgerJournalFormTable.

scenario:: In LedgerJournalTable form i want to disable the post button for perticular user group                           persons.


  Go to LedgerJournalFormTable class in enableButtonsActive method write following code.
 
           while select userGroupList
                     where userGroupList.groupId == "Post Group"
                             && userGroupList.userId == curUserId()
                          {

                              ctrlPostJournalMenu.enabled(false);
                           }


No comments:

Post a Comment

TFS Work space configuration

Refer below link:  https://d365byjp.blogspot.com/2018/10/steps-to-configure-tfsvsts-workspace-in.html