Quantcast
Channel: Reports & Macros
Viewing all articles
Browse latest Browse all 1118

Problem with dialogs function "canChangePage" after use of method 'setActiveWizardPages'

$
0
0

Hi ,

I am struggling with the next script, with a sample of some Dialogs routines.

Function ‘canGotoNextPage ‘ doesn’t work correct anymore when method 'setActiveWizardPages' is used in the script.

In next script the same dialog is called twice: the first time without use of method setActiveWizardPages, the second time with it.
The first time function ‘.canGotoNextPage’ is correct, the second time it isn’t.

Does anyone know what I'm doing wrong?

Many thanks in advance.

Best regards,

Ariene Kroeze

This is my code:

Dialogs.MsgBox("Dialog without setActiveWizardPages, runs correct")
Dialogs.showDialog(new my_dialog(false), Constants.DIALOG_TYPE_WIZARD_NONLINEAR, "Title" )

Dialogs.MsgBox("Dialog with setActiveWizardPages, doesn't run correct")
Dialogs.showDialog(new my_dialog(true), Constants.DIALOG_TYPE_WIZARD_NONLINEAR, "Title" )

function my_dialog(bDoActiveWizardPages){
    
    this.getPages = function(){
        var Template0 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 0");
        Template0.Text (10,10,400,20, "Text 0")
        
        var Template1 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 1");
        Template1.Text    (10,10,400,20, "Next textbox must have value")
        Template1.TextBox (10,30,400,20, "txtBox1",0)
        
        var Template2 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 2");
        Template2.Text (10,10,400,20, "Text 2")
        
        return [Template0, Template1, Template2]
    }
    this.init = function(){
        if (bDoActiveWizardPages){
            this.dialog.setActiveWizardPages([1,2]);           // <<<< this is the trouble making call
        }
    }
    this.isInValidState = function (iPageNumber){
        return true
    }
    this.canFinish = function (iPageNumber){
        return true
    }

    this.canGotoNextPage = function (iPageNumber){
        var lBool = true
        switch(iPageNumber){        
           case 1:
                var sName = this.dialog.getDialogElement("txtBox1").getText()
                if (sName==""){                    
                   lBool = false                    
                }
                break
        }
        return lBool
    }  
}

Viewing all articles
Browse latest Browse all 1118

Trending Articles