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

Tabbed Panel Listbox

Explorer ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

I have a listbox, which works fine when I use

var myBtn = w.add ("button", undefined, "Apply");

function updateButtons(){ 

    // call this function whenever something changes in the ui that should prevent some buttons to be clickable 

    myBtn.enabled = (myList.selection !== null); 

    // and maybe some other buttons to update 

    } 

myList.onChange = function(){ 

    updateButtons(); 

    // and maybe something else 

    };

myBtn.onClick = function(){

var listSel = myList.selection;  

var myComp = app.project.activeItem;

if(!myComp || myComp.typeName !== "Composition") return;

var n;

for (n=0; n<listSel.length; n++){ 

var Text1 = "Text1";

var Text2 = listSel.t

ext;

This works fine.

But I want three separate listboxes, but rather than clutter the screen. I have tabbed then like so...

var tpanel = w.add('tabbedpanel');

tpanel.preferredSize = [350,300];

var top = tpanel.add('tab', undefined, "Tops");

top.add("listbox", [0,0,200,150], ["Jumper","T Shirt"], {

    alignment: ['top','left'],

    multiline:true,

    multiselect:true,

    numberOfColumns:2,

    showHeaders: true,

    columnTitles: ['Tops','value']

    });

var bottom = tpanel.add('tab', undefined, "Bottoms");

bottom.add("listbox", [0,0,200,150], ["Trousers","Shorts"], {

    alignment: ['top','left'],

    multiline:true,

    multiselect:true,

    numberOfColumns:2,

    showHeaders: true,

    columnTitles: ['Bottoms','value']

    });

var shoe = tpanel.add('tab', undefined, "Shoes");

shoe.add("listbox", [0,0,200,150], ["Sneakers","Ugg Boots"], {

    alignment: ['top','left'],

    multiline:true,

    multiselect:true,

    numberOfColumns:2,

    showHeaders: true,

    columnTitles: ['Shoes','value']

    });;

Inregards to this....var listSel = myList.selection;

I want to be able to change it on the lines of - var listSel = tpanel.shoes.selection

If someone knows the answer it would be much appreciated.

TOPICS
Scripting

Views

432

Translate

Translate

Report

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

Enthusiast , May 24, 2017 May 24, 2017

You can get to the listbox selection within your tpanel via the following:

selection = tpanel.children[0].children[0].selection;

Votes

Translate

Translate
Enthusiast ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

You can get to the listbox selection within your tpanel via the following:

selection = tpanel.children[0].children[0].selection;

Votes

Translate

Translate

Report

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 26, 2017 May 26, 2017

Copy link to clipboard

Copied

Nearly there.

That worked from the moment I copied and pasted. Is there a way to Array it.

tpanel.children[0].children[0].selection;

tpanel.children[1].children[0].selection;

tpanel.children[2].children[0].selection;

I've tried the obvious ways, but it doesn't seem to work, or it goes for the highest value being 2.

Votes

Translate

Translate

Report

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 26, 2017 May 26, 2017

Copy link to clipboard

Copied

LATEST

I figured how to do it. I realised that my for loop, I hadn't changed a letter.

Votes

Translate

Translate

Report

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