2 Replies Latest reply on Feb 26, 2015 5:30 AM by machipotHocine

    Refresh dialog window

    machipotHocine

      Hi,

       

      I am stuck with a dialog refresh!!!

      I am trying to refresh my dialog in order to switch from one language to another

      any idea?

      Thank you,

       

      here is my portion of code:

       

        • 1. Re: Refresh dialog window
          UQg Level 4

          It is impossible to test your code if you post it in a picture.... and impossible to copy/paste to answer...

           

          The texts are not dynamically refreshed by the single statement $.locale="fr", even if you have used localize({en :"", fr: ""}) everywhere.

          For instance, the myWindow.text, which is localize({en: "Compare two documents", "fr: Comparer deux documents"}), is evaluated upon creation and then it is just a piece of string,

          what it would have been in the other case is completely forgotten.

           

          You need a function that sets the text for all widgets with a text property, and which can be called over and over when the user clicks one of the language buttons.

           

          Xavier.

          • 2. Re: Refresh dialog window
            machipotHocine Level 1

            Hi Xavier,

             

            Sorry, here is my code portion:

            For your info, in line 195 (picture code), when I replace it by $.locale = "fr";

            the dialog is displayed in French language.

            Thanks,

             


            ----- code-------------------

             

             

            function ShowDialog() {

            var mySavedDocs = [];

            var mySavedDocNames = []; 

            for (var j = 1; j < myDocs.length; j++) {

            if (myDocs[j].saved) {

             

            if (mySavedDocs.length == 0) OnError(localize({en: "You don't have any saved documents to compare with the active document.", fr: "Aucun document a comparer avec le document actuel"}));;

             

            var myWindow = new Window("dialog", localize({en: "Compare two documents", fr: "Comparer deux documents"}));

            myWindow.alignChildren = "fill";  

            // Properties for group language buttons

            var groupLng = myWindow.add('group',undefined);

            groupLng.orientation = "stack";

            groupLng.alignment = ['right','top'];

             

            var fButton = groupLng.add('iconbutton',undefined,"C:/Users/Pictures/F.jpg", {style:'toolbutton'});

            fButton.text = "Français";

            //fButton.onClick = lngPreference;

            //myWindow.layout = new AutoLayoutManager(myWindow);

            fButton.onClick = function(){

            fButton.visible = false;

            eButton.visible = true;

            $.locale = "en";

             

            var eButton = groupLng.add('iconbutton',undefined,"C:/Users/Pictures/E.jpg", {style:'toolbutton'});

            eButton.text = "English";

            //----default button language is english -----

            fButton.visible = true;

            eButton.visible = false;

            //----default language is english -----

            $.locale = "en";

             

            //eButton.onClick = lngPreference;

            eButton.onClick = function(){

            fButton.visible = true;

            eButton.visible = false;

            $.locale = "fr";

             

            // Properties for groupMain

            var groupMain = myWindow.add('group',undefined); 

            // Properties for group left

            var groupLeft = groupMain.add('group',undefined);

            groupLeft.add('image',undefined,"C:/Users/dahmanib/Pictures/compare.jpg"); 

            groupLeft.orientation = "column";

            groupLeft.alignChildren = "top"; 


             

            // Properties for Window1.Panel1.Group1.Image1

            var groupRight = groupMain.add('group',undefined);

            groupRight.orientation = "column";

            groupRight.alignChildren = "top";

             

            // Properties for Window1.Panel1

            var panelMain = groupRight.add('panel',undefined, localize({en: "- Compare Two Documents -" , fr: "- Comparer deux documents -"}));

            panelMain.alignChildren = "left";

             

            //panelMain.orientation = "ligne";

            var myGroup1 = panelMain.add("group");

            myGroup1.orientation = "row"; 

            var myStText1 = panelMain.add("statictext", undefined, myDoc1.name + localize({en: " with ", fr: " avec "}) );

            myStText1.helpTip = app.documents[0].fullName.fsName.replace("/Volumes/", ""); 

            var myDropdownlist = panelMain.add ("dropdownlist", undefined, mySavedDocNames); 

            myDropdownlist.helpTip = mySavedDocs[myDropdownlist.selection.index].fullName.fsName.replace("/Volumes/", ""); 

            myDropdownlist.helpTip = mySavedDocs[myDropdownlist.selection.index].fullName.fsName.replace("/Volumes/", "");

             

            myDropdownlist.onChange = function() {

            myDropdownlist.helpTip = mySavedDocs[myDropdownlist.selection.index].fullName.fsName.replace("/Volumes/", "");

            var myDropdownlistSelected = myDropdownlist.items[myDropdownlist.selection.index];

             

            }

            }