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

Needed Help to create the searchable drop down list

Explorer ,
May 20, 2019 May 20, 2019

Hi Everyone

I have 197 layer names. As per my client standard, it is too long to scroll this list. So i need to create the searchable drop-down list in dialog palate. If you have any advice kindly share with an example script.

Screen Shot 2019-05-20 at 5.38.46 PM.png

Thanks in advance.

Kalaimani S

TOPICS
Scripting
1.4K
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 , May 20, 2019 May 20, 2019

For the beginning: an example from Peter Kahrel​ s ScriptUI for Dummies ScriptUI for dummies | Peter Kahrel

var numbers = ["one", "two", "three", "thirty", "hundred"];

var w = new Window ("dialog", "Drop-down select");

var ddown = w.add ("dropdownlist", undefined, numbers);

ddown.minimumSize.width = 200;

ddown.selection = 0; ddown.active = true;

var buffer = "";

ddown.onActivate = function () {buffer = ""}

ddown.addEventListener ("keydown", function (k)

{

buffer += k.keyName.toLowerCase();

var i = 0;

while

...
Translate
Adobe
Community Expert ,
May 20, 2019 May 20, 2019

For the beginning: an example from Peter Kahrel​ s ScriptUI for Dummies ScriptUI for dummies | Peter Kahrel

var numbers = ["one", "two", "three", "thirty", "hundred"];

var w = new Window ("dialog", "Drop-down select");

var ddown = w.add ("dropdownlist", undefined, numbers);

ddown.minimumSize.width = 200;

ddown.selection = 0; ddown.active = true;

var buffer = "";

ddown.onActivate = function () {buffer = ""}

ddown.addEventListener ("keydown", function (k)

{

buffer += k.keyName.toLowerCase();

var i = 0;

while (i < numbers.length-1 && numbers.toLowerCase().indexOf (buffer) != 0)

{++i;}

if (numbers.toLowerCase().indexOf (buffer) == 0)

ddown.selection = i;

}

);

w.add ("button", undefined, "OK");

w.show ();

Have fun

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
Explorer ,
May 20, 2019 May 20, 2019

I am already completed with the dropdown List but I need search option in the dropdown list. Kindly advice.

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
Community Expert ,
May 21, 2019 May 21, 2019

As Pixxxel mentioned, there are several examples of searchable dropdown lists in that guide.

P.

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
Contributor ,
May 21, 2019 May 21, 2019
LATEST

Hello,

I suppose there is no direct way to do this using ScriptUI. If you can use HTML, you can use select2. Otherwise inbuilt dropdown needs to be changed by adding edit text in stack order and filter list of the dropdown on change of key press.

Regards

Charu

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