Hi,

I found a method to add a Picture in a page of a dialogTemplate, but I have no idea of how to proceed to set the picture with my png file.

I didn't found a solution matching this case in the existing topics of the forum.

Please see below an example of code where I try to display a picture in the page[0]:

var logger      = new Logger();
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 myPicture = Context.createPicture("warning.png");
var myPicture = Context.getFile("warning.png",Constants.LOCATION_COMMON_FILES);
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");

      iDialogTemplate1.OptionGroup("OPTIONGROUP");
     // iDialogTemplate1.OptionButton(10,30,400,30,"create","OPTION_0");
     // iDialogTemplate1.OptionButton(10,60,400,30,"delete","OPTION_1");
      
      iDialogTemplate1.OptionButton(10,30,200,30,"Créer une relation","OPTION_0");
      iDialogTemplate1.OptionButton(220,30,200,30,"Supprimer une relation","OPTION_1");
      
      iDialogTemplate1.Picture(10,155,40,40,"PICT");
      //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)
 {
    aPages[0].getDialogElement("OPTION_0").setVisible(true);
    aPages[0].getDialogElement("OPTION_1").setVisible(true);
    //aPages[0].getDialogElement("PICT").setText(pict); //KO
    
 }

 // 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]);
     
     
 }
 this.dialog.setDlgPicture("PICT", myPicture, 2);
}

 
 

I tried different things to set the Element "PICT", without success...

Thanks in advance to the one who'll have an idea !

 or register to reply.

Notify Moderator