FR

Hi,

 

I've created a dialog in my script, including 2 pages.

Those pages have the basic buttons (next/previous, cancel, validate). Then, I also added personnalized buttons in the second page. But I have difficulties to make those buttons do exactly what I want.

For example, I've added a button in page 2

iDialogTemplate2.PushButton(10, 170, 200, 28, "Add a new relation", "BUTTON_NEW");

I've created the dedicated function :

 this.BUTTON_NEW_pressed = function()
 {
      //treatment to save the results

      //call to page 0
 }

The treatment to save the results works well (I haven't detailed it). My issue is when I tried to reload the Page(0) of the Dialog. I don't know how to proceed. Does someone know how to reopen the page 0 when you click on a button on page 1 ?

by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 10/27/2015 - 10:46

Have you tried 

Dialog.setDlgFocus ( int nDlgItemIndex ) to set the focus again to an element on the first page ?

Or you could try to do something with

setActiveWizardPages ( int[] activePages )

BR Robert

0
by Fabienne ROSEC Author
Posted on Wed, 10/28/2015 - 11:45

Hi BR Robert,

List you suggested, I tried de setDlgFocus function, but it seems I can't apply it to the dialog element...

Error : Cannot find function setDlgFocus in object UserDialog

The setActiveWizardPages doesn't seem to work either. It specifies which pages are visible but doesn't switch from one to another.

Here a testing code - if someone has the courage to test other ideas :

var loc         = Context.getSelectedLanguage();
var user        = ArisData.getActiveUser();
var db          = ArisData.getActiveDatabase();
var filter      = ArisData.ActiveFilter(); // Filtre actif
var filter_guid = filter.GUID(); // GUID du filtre actif
var result = Dialogs.showDialog(new myDialog(), Constants.DIALOG_TYPE_WIZARD, "Création/Suppression de relations");


////////////////////////////////////////////// Fonctions //////////////////////////////////////


 function myDialog()
 {
  // all member functions except for getPages can access the property "dialog" of the dialog class. Type is "UserDialog" (see help).
  // examples:
  // - Get the page with the specified index (e.g. 0): this.dialog.getPage(0)
  // - Define the list of visible wizard pages (e.g. 0,1): this.dialog.setActiveWizardPages([0,1])

  // returns DialogTemplate[]
  // non-optional
  var createRelationObjectName;
  var symbList = new Array();
  symbList[0] = ["Function","Cluster"];
  symbList[1] = ["obj1","obj2"];//[["obj1","obj2","obj3"],["obj4","obj5","obj6"]];
  
  this.getPages = function()
  {
      /********* 1er écran *********/
      var iDialogTemplate1 = Dialogs.createNewDialogTemplate(600, 200, "Creation of a relation");
      iDialogTemplate1.ComboBox(10, 120, 200, 40, symbList[0], "SYMB_LIST_1");

      //actions
      iDialogTemplate1.CancelButton(); 
      
      /********* 2nd écran *********/
      var iDialogTemplate2 = Dialogs.createNewDialogTemplate(400, 200, "Validation");
      iDialogTemplate2.Text(10, 30, 1600, 40, "", "TEXT_2_2");      
   
      //actions
      iDialogTemplate2.CancelButton(); 
      iDialogTemplate2.PushButton(10, 170, 200, 28, "add a new relation", "BUTTON_NEW");
      return [iDialogTemplate1, iDialogTemplate2];
  }

 // initialize dialog pages (are already created and pre-initialized with static data from XML or template)
 // parameter: Array of DialogPage
 // see Help: DialogPage
 // user can set control values
 // optional
 this.init = function(aPages)
 {

 }

 // returns true if the page is in a valid state. In this case "Ok", "Finish", or "Next" is enabled.
 // called each time a dialog value is changed by the user (button pressed, list selection, text field value, table entry, radio button,...)
 // pageNumber: the current page number, 0-based
 this.isInValidState = function(pageNumber)
 {
    return true;
 }

 // called when the page is displayed
 // pageNumber: the current page number, 0-based
 // optional
 this.onActivatePage = function(pageNumber)
 {
 }
 // returns true if the "Finish" or "Ok" button should be visible on this page.
 // pageNumber: the current page number, 0-based
 // optional. if not present: always true
 this.canFinish = function(pageNumber)
 {  
    return true;    
 }

 // returns true if the user can switch to another page.
 // pageNumber: the current page number, 0-based
 // optional. if not present: always true
 this.canChangePage = function(pageNumber)
 {
    return true;
 }

 // returns true if the user can switch to next page.
 // called when the "Next" button is pressed and thus not suitable for activation/deactivation of this button
 // can prevent the display of the next page
 // pageNumber: the current page number, 0-based
 // optional. if not present: always true
 this.canGotoNextPage = function(pageNumber)
 {
    return true;
 }

 // returns true if the user can switch to previous page.
 // called when the "Back" button is pressed and thus not suitable for activation/deactivation of this button
 // can prevent the display of the previous page
 // pageNumber: the current page number, 0-based
 // optional. if not present: always true
 this.canGotoPreviousPage = function(pageNumber)
 {
    return true;
 }

 // called after "Ok"/"Finish" has been pressed and the current state data has been applied
 // can be used to update your data
 // pageNumber: the current page number
 // bOK: true=Ok/finish, false=cancel pressed
 // optional
 this.onClose = function(pageNumber, bOk)
 {
 }

 // the result of this function is returned as result of Dialogs.showDialog(). Can be any object.
 // optional
 this.getResult = function()
 {
     return null;
 }

 this.SYMB_LIST_1_selChanged = function()
 {
    var symbListRange = this.dialog.getPage(0).getDialogElement("SYMB_LIST_1").getValue();
    createRelationObjectName = symbList[1][symbListRange];  
    this.dialog.getPage(1).getDialogElement("TEXT_2_2").setText("selected object : "+createRelationObjectName);
 }
 this.BUTTON_NEW_pressed = function()
 {
     //this.dialog.setDlgFocus(0); //KO
     //this.dialog.getPage(0).setDlgFocus(0); //KO
     //this.dialog.setActiveWizardPages([0]); //do nothing
     
 }
 
}

 

 

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Wed, 10/28/2015 - 14:04

Hi Fabienne,

you would have to use " this.dialog.getPage(0).setDlgFocus(0)" for the command to work, but sadly, this does not help. And I haven't found any other commands to switch the page...

BR Robert

0

Featured achievement

Question Solver
Share your expertise and have your answer accepted as best reply.
Recent Unlocks
  • ПЦ
  • CR
  • BH
  • Profile picture for user Ivan.Ivanov.softwareag.com
  • Profile picture for user mscheid
  • PacMan

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