MsgBox does not work

    MsgBox does not work

    Hello everyone

    I am trying to learn macros on Jedox Web V7. To do that, I am using the Jedox Macro Engine API Documentation and this forum.

    I am trying to show a MsgBox when I click on a button, but nothing happens.

    The macro code is the following:

    Source Code

    1. function return_msgbox()
    2. {
    3. // define parameters for the message box
    4. $message = 'Your input is invalid!';
    5. $caption = 'Invalid input';
    6. $type = 'warn';
    7. // return a message box
    8. return __msgbox($message, $caption, $type);
    9. }
    10. function _Button1_Click()
    11. {
    12. return_msgbox();
    13. }




    The button name is Button1.



    I do not understand what is the problem.

    Could someone help me?

    Regards
    Lino

    chinmay213_jedox wrote:

    can you try to assign return_msgbox function on button click rather than Button_click function ?


    Thanks for your effort, chinmay, but it seems that there is a problem with the function names. For example:

    The following does not work:

    Source Code

    1. function _Button1_Click()
    2. {
    3. activesheet()->range('A1:C2')->value = 'Foo';
    4. }


    The following works:

    Source Code

    1. function __open()
    2. {
    3. activesheet()->range('A1:C2')->value = 'Foo';
    4. }


    The following partially works. The cells are filled in, but the msgbox does not appear.

    Source Code

    1. function __open()
    2. {
    3. activesheet()->range('A1:C2')->value = 'Foo';
    4. return __msgbox('test', 'test', 'warn');
    5. }

    kiran.gs wrote:

    have you assigned the Macro _Button1_Click() to the command button?


    Hi Kiran

    You are right. I did not assign the function to the element. It is my first time with macros on Jedox Web. I thought the assigning of the macro was automatic, because I created a new macro through Right click on the element (e.g. Button) -> Assign Macro... -> New. So, the macro is created, but not assigned. I did not know.

    Anyway, thanks for your support. Now, it works.

    Regards
    Lino