HR

Hallo all together,

my problem is the escape from a user dialog in a report.

I've created a dialog window in my report similar to the example on the help side "Report class DialogObject". I've adapted it to my report as a single side dialog and it works, excepted one feature. I can click "OK" and the dialog ends and I can click "Escape" and it also ends.

But how can I read in my report, which button has finalized the dialog?

Therefore I could'nt find any notes in the help side.

I wold be happy if is somebody who can help me.

Many thanks.

by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 02/14/2017 - 11:32

Hi,

well, normally you can catch that someone has pressed a button like this:

        iDialogTemplate1.PushButton(15, 322, 80, 20, "Standard","buttonStandard");

...

    this.buttonStandard_pressed = function(){

        INIT_ReadStandardOptions();

        this.setBasicValues();

        this.enableStandard();

        

        return true;

    }

 

So you should be able to set a global variable and then end the dialog...

BR Robert

 

0
by Holger Reidemeister Author
Posted on Tue, 02/14/2017 - 12:30

Hallo Robert,

many thanks for your answer. In the described way you generate a new button. But the dialog has still two buttons: One for "OK" and one for "Cancel". Do you know the id of one of these buttons? Then I can set a global variable as you mentioned.

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 02/14/2017 - 13:28

Well, somewhere there was an ID once for those two buttons, but they never (!) worked. You could also not remove them etc. - could be called a bug, could be called a feature :-)

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 02/14/2017 - 13:29

Ah, but you just want to know if cancel was pressed ?

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 02/14/2017 - 13:30

    var lResult = Dialogs.showDialog(new DIA_configSubDialog(), Constants.DIALOG_TYPE_WIZARD , "Transfer Model Changes");

    if (lResult != -1)

        return false;

 

...

 

    this.onClose = function(pageNumber, bOk){

        if (bOk){

            this.lResult = -1;

        }

    }

 

    this.getResult = function(){

        

        if (this.lResult == -1){

...

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 02/14/2017 - 13:31

        return this.lResult;

 

0
by Holger Reidemeister Author
Posted on Wed, 02/15/2017 - 12:00

Hallo Robert,

thanks for your effort and your ideas. But (sorry) it does not work. I guess the reason is the this.onClose function would never be called (I sat a breakpoint in this function). Doesn't matter if I finish with "OK" or with "Cancel". So there is no chance to set this.lResult.

Could be a bug?

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Wed, 02/15/2017 - 13:14

Hi Holger,

well, you cannot debug a dialog - breakpoints don't work there...   But it definitely works like this - so you can distinguish between the standard ok and the standard cancel button. But I think my code was not enough. Try this one:

main(){

    if(DIA_configDialog()){

            ....

    }

}

function DIA_configDialog(){

    

    // set selection to global options

    var lResult = Dialogs.showDialog(new DIA_configSubDialog(), Constants.DIALOG_TYPE_WIZARD, "Name of the script");

    if (lResult != -1)

        return false;

    

    return true;

}

 

function DIA_configSubDialog(){

    var sPassword = "";    

    var lResult = 0;

    

    // returns DialogTemplate[] (see help) or the dialog XML ID

    this.getPages = function(){

        var iDialogTemplate1 = Dialogs.createNewDialogTemplate(0, 0, 0, 0, "Script options");

        iDialogTemplate1.GroupBox(15, 10, 420, 60, "  " + "Password secured" + "  ");

        iDialogTemplate1.Text(30, 35, 200, 15, "Please insert script password:");

        iDialogTemplate1.TextBox(230, 35, 160, 15, "password", -1)

        iDialogTemplate1.OKButton();

        iDialogTemplate1.CancelButton();

        return [iDialogTemplate1];

    }

    

    this.isInValidState = function(pageNumber){

        return true;

    }

    

    this.canFinish = function(pageNumber){

        return true;

    }

    

    this.canChangePage = function(pageNumber){

        return true;

    }

    

    this.onClose = function(pageNumber, bOk){

        if (bOk){

            this.lResult = -1;

        }

    }

    

    this.getResult = function(){

        

        if (this.lResult == -1){

            sPassword = this.dialog.getPage(0).getDialogElement("password").getText();

            if(sPassword == "" || !sPassword.equals("I like IDS")){

                Dialogs.MsgBox("Wrong password, report execution canceled.", Constants.MSGBOX_ICON_INFORMATION, "Password secured");

                Context.setScriptError(Constants.ERR_CANCEL);

                return false;

            }

        }

        return this.lResult;

    }

}

 

0
by Holger Reidemeister Author
Posted on Thu, 02/16/2017 - 10:04

Hallo Robert,

so it works. Many many thanks for your help.

0
by Rene Broll
Posted on Fri, 03/02/2018 - 11:59

Is it possible to show a MsgBox after I press the finish button? And in the MessageBox I have the option to say "No" and the old dialog comes back with the filled information? 

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock