Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to select item into ListBox ?

Participant ,
Jun 13, 2017 Jun 13, 2017

Hi all !

How to programmatically select item in the ListBox by item index?

listbox1.selection.index=1 -  not worked

TOPICS
Actions and scripting
757
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 13, 2017 Jun 13, 2017

Works for me. I also as save the user's last choice so  the next time the dialog is used the default may not be 1.

Here is what I user in some of my scripts.

Capture.jpg

dlg.msgPnl.grp5a =dlg.msgPnl.add('group');
dlg.msgPnl.grp5a.orientation='row';
dlg.msgPnl.grp5a.alignment='fill';
dlg.msgPnl.grp5a.st1 = dlg.msgPnl.grp5a.add('statictext',undefined,'Name Stamp Text  Location:');
var position =['Top Left','Top Center','Top Right','Center Left','Center','Center Right','Bottom Left','Bottom Center','Bottom Right'];
d
...
Translate
Adobe
Community Expert ,
Jun 13, 2017 Jun 13, 2017

Works for me. I also as save the user's last choice so  the next time the dialog is used the default may not be 1.

Here is what I user in some of my scripts.

Capture.jpg

dlg.msgPnl.grp5a =dlg.msgPnl.add('group');
dlg.msgPnl.grp5a.orientation='row';
dlg.msgPnl.grp5a.alignment='fill';
dlg.msgPnl.grp5a.st1 = dlg.msgPnl.grp5a.add('statictext',undefined,'Name Stamp Text  Location:');
var position =['Top Left','Top Center','Top Right','Center Left','Center','Center Right','Bottom Left','Bottom Center','Bottom Right'];
dlg.msgPnl.grp5a.dd1 = dlg.msgPnl.grp5a.add('dropdownlist',undefined,position);
dlg.msgPnl.grp5a.dd1.selection=textLocationDefault;

dlg.msgPnl.grp6a =dlg.msgPnl.add('group');
dlg.msgPnl.grp6a.orientation='row';
dlg.msgPnl.grp6a.alignment='fill';
dlg.msgPnl.grp6a.st1 = dlg.msgPnl.grp6a.add('statictext',undefined,'Font');
fontlist = new Array();
for (var i=0,len=app.fonts.length;i<len;i++) {
fontlist =  app.fonts.name;
}
dlg.msgPnl.grp6a.dd1 = dlg.msgPnl.grp6a.add('dropdownlist',undefined,fontlist);
dlg.msgPnl.grp6a.dd1.selection=1;

dlg.msgPnl.grp7a =dlg.msgPnl.add('group');
dlg.msgPnl.grp7a.orientation='row';
dlg.msgPnl.grp7a.alignment='fill';
dlg.msgPnl.grp7a.st1 = dlg.msgPnl.grp7a.add('statictext',undefined,'Text Layer Style:  ');
dlg.msgPnl.grp7a.dd1 = dlg.msgPnl.grp7a.add('dropdownlist',undefined,textStyleList);
dlg.msgPnl.grp7a.dd1.preferredSize.width = 160;
dlg.msgPnl.grp7a.dd1.selection=textStyleDefault;

dlg.msgPnl.grp8a =dlg.msgPnl.add('group');
dlg.msgPnl.grp8a.orientation='row';
dlg.msgPnl.grp8a.alignment='fill';
dlg.msgPnl.grp8a.st1 = dlg.msgPnl.grp8a.add('statictext',undefined,'Image Layer Style:');
dlg.msgPnl.grp8a.dd1 = dlg.msgPnl.grp8a.add('dropdownlist',undefined,imageStyleList);
dlg.msgPnl.grp8a.dd1.preferredSize.width = 160;
dlg.msgPnl.grp8a.dd1.selection=imageStyleDefault;
JJMack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 13, 2017 Jun 13, 2017
LATEST

yes.. listBox.selection.index =1

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines