InDesign CC Listbox.removeAll() problems (Mac 10.7.5)


hello forum:

 

using indesign cc on mac 10.7.5 creating ui looks (i cut lot out brevity's sake):

 

//  declared globals.

var urllist   = new array();

var emaillist = new array();

 

var doublelistwindow               = new window("dialog", "list inspection dialog", [200,  200, 900, 1000]);

   

doublelistwindow.button1  = doublelistwindow.topbuttonpanel.add("button", [165, 10, 345, 30], "expand list 1");

doublelistwindow.button2  = doublelistwindow.topbuttonpanel.add("button", [355, 10, 535, 30], "expand list 2");

 

//  other button looks same except works other list.

doublelistwindow.button2.onclick = function()

{   

     listtouse = list2;

     loadlist(list2, singlelistewindow.addresslistbox);       

     singlelistewindow.show();       

}

 

 

doublelistwindow.box1  = doublelistwindow.listboxpanels.add(    "listbox", [  0,   5, 345, 760], {multiselect: false, items:   urllist});

doublelistwindow.box2  = doublelistwindow.listboxpanels.add(    "listbox", [355,   5, 700, 760], {multiselect: false, items: emaillist});

loadlist(list1, doublelistwindow.box1);

loadlist(list2, doublelistwindow.box2);

 

 

and finally, loadlist looks this:

 

function loadlist(list, box)

{

   var templist = new array();

    

   // if comment out loadlist works fine except entries in listbox double. 

   box.removeall();

  

   // added see if fix problem.  did not.

   // if create templist , use fill listbox, on second call loadlist

   // 2 arrays made invalid , listbox not fill

   for(var b = 0; b < list.length; b++)

       templist[b] = list[b];

    

   var = 0;

   while(a < templist.length)

   {

      box.add("item", templist[a]);

      a++;

   }

}   

 

singlelistwindow looks (pared down brevity):

 

var singlelistewindow             = new window("dialog", "list2", [300,  300, 1000, 1100]);  

singlelistewindow.addresslistbox  = singlelistewindow.middlepanel.add("listbox", [0,0,700,664], {multiselect: false});

 

the problem loadlist works fine on first call load listbox, if dismiss listbox2, recall it, second call loadlist tanks.

the problem seems in box.removeall() command.  not remove line items box, causes list become invalid.

i have tried several permutations of script try small section work, reason removeall command wants remove more line items in list box.  wants remove in array associated list box well.

 

i going try few other ideas see whether can make work.  have thoughts doing wrong?

 

tia

john



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Some mp4 files not displaying correctly (CS6)

Thread: Samba is not authenticating with LDAP