Skip to main content
Participant
December 11, 2021
Question

XMP CustomFileInfo Panel using MetadataUI: challenges on having multiselect dropdown field

  • December 11, 2021
  • 1 reply
  • 938 views

Hi,

I am trying to built a custom fileinfo Panel for CC applications, I referred to XMP Metadata UI SDK CC 2014 guide and built one successfully.

But I need a field where users can select multiple values from dropdown, and those will be saved into a single XMP property (e.g., <sampleSchema:cities>).

Anyone developed or solved the similar problem in CustomFileInfo panels?

Your help really appreicated.

 

This topic has been closed for replies.

1 reply

gregreser
Legend
December 12, 2021

I'm sorry to tell you that the dropdown can only have one selection. You will have to use a list box instead. You might not want a bunch of big list boxes filling up your UI, so you could create a pseudo drop down by setting the listbox height to 0 and using a button that expands it to a larger height revealing the list. On a button click, or some other event, the list box could go back to a height of 0 and save the selected values.

 

Here is a sample solution, but there are a lot of other possibilities. There is some weirdness in ScriptUI controlls like preferredSize, minimumSize, and maximumSize, so you might have to try different combinations to get the desired display in Windows or Mac.

 

var win = new Window('palette',"listbox as dropdown", undefined, {closeButton:true});

var keywords = ["one", "two", "three","four","five","six","seven"]

list1Grp = win.add('group');
list1Grp.orientation = 'column';
list1Grp.alignChildren = 'left';
list1Grp.spacing = 0;

list2Grp = list1Grp.add('group');
list2Grp.orientation = 'row';
list2Grp.alignChildren = 'left';
list2Grp.spacing = 0;

list1Txt = list2Grp.add('statictext',undefined,"Select Keywords");
list1Txt.preferredSize=[280,25];
list1Btn = list2Grp.add('button',undefined,"🔻");
list1Btn.preferredSize=[20,20];

var list1 =list1Grp.add ('listbox', undefined, keywords, {multiselect: true});
list1.preferredSize=[280,0];

list2Btn = list1Grp.add('button',undefined,"Add Keywords");
list2Btn.preferredSize=[280,20];
list2Btn.visible = false;

list1Btn.onClick=function(){
    list1.minimumSize=[280,150];
    list1.maximumSize=[280,150];
    list2Btn.visible = true;
    win.layout.layout (true);
    }

list2Btn.onClick=function(){
    if(list1.selection == null){
        list1Txt.text = "Select Keywords";
        }
     else{
        list1Txt.text = list1.selection.join("; ") // Display the list selections. You could  use this to write to XMP or put the list selections in an array to write to XMP
        }
    list1.minimumSize=[280,0];
    list1.maximumSize=[280,0];
    list2Btn.visible = false;
    win.layout.layout (true);
    }

win.show();

 

 

Participant
December 12, 2021

Thanks, but it seems like this is javascript, and user needs to run everytime if they need to add the metadata.

Is there any other way to have always running UI where users can simply click and add the multi select values?

Also, this UI what I am looking for should work some of CC applications (Bridge, Illustrator, Photoshop).

Kukurykus
Legend
December 12, 2021

Why don't you read docs how to add buttons to Bridge, automatically when it's launching.