miércoles, 20 de julio de 2011

Dialog class and the 'Next' big thing

Many effects are very easy to achieve in Ax 2009 but others leave us searching the interweb for a solution.  We needed a 'Next' (or 'Continue') and 'Cancel' button in a simple message box with instructions.  For some reason the standard 'Ok' button text was not sufficient. 

   // Dialog with instructions
    Dialog                          dialog;
    FormBuildCommandButtonControl   okButton;
    #define.okButton('OkButton')    //See Dialog class
    ;
    
    dialog = new Dialog("@SYS76421");

    // Instructions, Instructions, Instructions
    dialog.addText("@EVE580");
    okButton = dialog.formBuildDesign().control(#okButton);
    if (okButton)
    {
        // Select Next to resume (EN) / Selecciona Siguiente para continuar (ES)
        okButton.helpText("@EVE581");
        // Next (EN) / Siguiente (ES)
        okButton.text("@SYS6441");
        okButton.defaultButton(true);
    }

    dialog.run();
    if (dialog.closedOK())
    {
        Box::info("We closedOK!");
        return;
    } else {
        return;
    }

As always, someone cleverer than me was able to grab a handle to what was going on.  In my version of Axapta the commented code in the Dialog.initButtons() function will get you on your way to get a handle on those Dialog buttons.

No hay comentarios:

Publicar un comentario