Button in SysOperation dialog

Hi,

Please find below my requirements to be implemented by SysOperationFramework:

  1. need to add a button(simple) as if user clicks there, an info message regarding format of file to be displayed.

  2. I M unable to clear the previous values in the fields ,may I request your guidance regarding Pack and Unpack in sysoperation framework??

Can you elaborate your requirements, please? I also suggest you split your two questions to two separate threads.
And please attach a tag with your version of AX.

My requirement is :

On dialog box, I need to put a BUTTON(not a menu item button), On clicking, an info message must be shown for example “Hello World”(i.e.,).

I can see, through sysoperation, I can only add a MenuItemButton. Please guide.

First of all, you again forgot your version of AX. SysOperation framework exists in both AX 2012 and AX 7.

Also, how do you build the dialog?

Version - Ax 2012

I have built 4 classes, based upon the need and functionality. The classes are: UIBuilder, Contract,Services, Controller.

Thanks - I’ve attached the tag for you this time.

I know these classes; it tells me nothing about your problem.

Hi Martin,

Thanks for your help ! I can’t see the tag.

Here it is:

tag.png

You still haven’t told me anything about your problem, so let me assume that you’re trying to extend the automatically generated UI builder, you’ve created a custom UI builder class but you don’t know either how to add the button or how to react to a click. Nevertheless you don’t need any help regarding the message.

In that case, override build() method of your UI builder class and put code like this there:

FormBuildButtonControl button;

super();

button = this.dialog().formBuildDesign().addControl(FormControlType::Button, 'MyButton');
button.registerOverrideMethod(methodStr(FormButtonControl, clicked), methodStr(MyUIBuilder, buttonClicked), this);

Change names as appropriate in your case.

Note that the method running on button click must accept a single parameter of type FormButtonControl.

Thanks Martin ! This works, in addition to this, can you please let me know, if the methods in line number 6 where to be added? in which class?

It’s up to you. My code above says that it’s a method in MyUIBuilder class and the instance is the current object (this). You can use any other class by changing these parameters.

Thanks ! But I need only an Info message. I don’t think, I have to write any method. Your valuable comments please

Hmm, and where will you put your code if not into a method? Try it and you’ll see… :slight_smile:

I am getting following error:

Stack trace: The method has been called with an invalid number of parameters.

Stack trace

(C)\Classes[UIBuilder class name]\method(new)

If I am running the same method separately, It is running fine, but it is throwing me error, if I am using the following syntax:
button.registerOverrideMethod(methodStr(FormButtonControl, clicked), methodStr(UIBuilder class name, method(new)), this);

This is not valid X++ code. Please give your actual code, so I don’t have to guess what’s a bug and what’s just caused by imprecise copying.
If you really try to use a constructor (new()), then it makes no sense and obviously can’t work. Use a method with the parameter type explained above.