RB

Hey guys,

I want to create a reset button, that reset all inputs from the user. (should actually be no problem)

But i get some issues with: this.dialog.getPage(0).getDialogElement("COMBO_LANGUAGE").setSelection(0)

I don´t know why, but when I want to set the selection of a combobox, Aris doesn´t want to change the selection.

I want to set the selection to index 0 and then make the combobox setEnabled(false).

But the only thing what aris does, is to set the combox enabled(false) but not to set the selection to index 0.

 

But, when I print the current getSelection() of the combobox I get the value of index 0, so it seems that Aris doesn´t  update the dialog view ...

Is there a way to refresh/update the window? 

Thanks!!

 

 

The code:

this.OPTIONGROUP_selChanged = function() {  

       

        (...)

        

        if (this.dialog.getPage(0).getDialogElement("OPTIONGROUP").getSelectedIndex() == 1) {

            this.dialog.getPage(0).getDialogElement("COMBO_LANGUAGE").setEnabled(true);

            (...)



        } else{

            this.dialog.getPage(0).getDialogElement("COMBO_LANGUAGE").setSelection(0);

            if(this.dialog.getPage(0).getDialogElement("COMBO_LANGUAGE").isEnabled()){

            this.dialog.getPage(0).getDialogElement("COMBO_LANGUAGE").setEnabled(false);

            }

            (...)

                  

    }

by Kay Fischbach
Posted on Fri, 08/10/2018 - 11:57

Could you describe the problem by describing the setup, and which steps to undertake to reproduce the unexpected behavior? E.g. you allow the string values x, y and z to be selected in the combobox when you create the combobox, then you start the macro and set the combobox to value y and when you trigger the reset the combobox value is set to x and the combobox gets disabled.

Just asking because I have a hard time reproducing your problem. I admittedly used a Report script instead of a Macro, but with Dialogs working the same in both (only how they are shown is different) this shouldn't be a huge issue:

 

Dialogs.showDialog(new myDialog(), Constants.DIALOG_TYPE_ACTION, "Just a test")

function myDialog(){
   
    this.getPages = function()
    {
        var iDialogTemplate1 = Dialogs.createNewDialogTemplate(600, 300, "First page");
       
        iDialogTemplate1.PushButton(15, 20, 40, 30, "Test", "PB1");
        iDialogTemplate1.ComboBox(15, 80, 70, 30, ["Test 1", "Test 2", "Test 3", "Test 4", "Test 5", "Test 6"], "CB1");
       
        return [iDialogTemplate1];
    }
   
    this.PB1_pressed = function(){
        this.dialog.getDialogElement("CB1").setSelection(0);
       
        if(this.dialog.getDialogElement("CB1").isEnabled()){
            this.dialog.getDialogElement("CB1").setEnabled(false);
        } else {
            this.dialog.getDialogElement("CB1").setEnabled(true);
        }
    }
}

 

I can start the report and a dialog is shown, I can set the value of the combo-box to "Test 4", and when I press the button it resets the combobox-value to "Test 1" and disables the combo-box. Pressing the button again re-enables the combobox and I can set another value again, press the button and it resets the value to "Test 1" and disables the combobox, just as expected.

0
by Rene Broll Author
Posted on Fri, 08/10/2018 - 12:16

Again you Kai, thank you very much for your time!



So i tried your code and you say your combobox-value is set to "Test-1" after you click on the button.

In my case it doesn´t work, it just setEnabled(false) ... very strange

0
by Rene Broll Author
Posted on Fri, 08/10/2018 - 12:49

Maybe I found a solution for my strange problem... It works but it is not so nice.

The function isInValidState() is called each time a dialog value is changed by the user, so with help the var resetModus I can change the selection of the combobox... idk why it only works this way.

Dialogs.showDialog(new myDialog(), Constants.DIALOG_TYPE_ACTION, "Just a test")
var resetModus = 0;
function myDialog(){
   
    this.getPages = function()
    {
        var iDialogTemplate1 = Dialogs.createNewDialogTemplate(600, 300, "First page");
       
        iDialogTemplate1.PushButton(15, 20, 40, 30, "Test", "PB1");
        iDialogTemplate1.ComboBox(15, 80, 70, 30, ["Test 1", "Test 2", "Test 3", "Test 4", "Test 5", "Test 6"], "CB1");
       
        return [iDialogTemplate1];
    }
   
   this.PB1_pressed = function(){        
       resetModus = 1;
       
       if(this.dialog.getDialogElement("CB1").isEnabled()){
           this.dialog.getDialogElement("CB1").setEnabled(false);
       } else {
           this.dialog.getDialogElement("CB1").setEnabled(true);
       }
   }
     
   this.isInValidState = function(pageNumber)
   {
       if(resetModus==1){
           this.dialog.getDialogElement("CB1").setSelection(0);
       }
       resetModus = 0;
       
   }
}
0
by Kay Fischbach
Posted on Fri, 08/10/2018 - 13:26

In reply to by rocks1996

Glad to hear that you found a solution. Strange that setSelection doesn't work in the _pressed reaction-function, but does work in the isInValidState function.

For future reference, may I ask which ARIS version you are using? The version I'm using (where setSelection does work in the reaction method) is version 10.0.3.

Also just a side note: the return value of setSelection is not described in my version of the ArisScript help, but the method does return a boolean true for me. Maybe that's if the selection was successfully changed? Does it return anything for you? just place a "text" somewhere in your dialog and save the return value of setSelection to a variable, then set the text of the "Text" to the value of the variable.

0
by Rene Broll Author
Posted on Mon, 08/13/2018 - 08:54

In reply to by Kay Fischbach

I use the version 98.5.0

The method setSelection return the value true, so it definitely works and the return value of getSelection is 0, so setSelection(0) works but only the view is not correct. 

I think this is a bug or an error of my version...

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