Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions add/remove buttons/dropdownlist from dockable panel UI

  • add/remove buttons/dropdownlist from dockable panel UI

    Posted by Jacob Danell on May 20, 2014 at 11:02 pm

    Hi! I’m looking for a way to being able to add and remove parts from a dockable panel UI. The ones looking like this:
    var my_palette = (thisObj instanceof Panel) ? thisObj : new Window("palette", jdaempeg.scriptName + " v" + jdaempeg.scriptVersion, undefined, {
    resizeable: true
    });
    if (my_palette != null) {
    var res =
    "group {orientation:'column', alignment:['fill','fill'], spacing:0, margins:[0,0,0,0], \
    firstRow: Panel { text:'Original File:', orientation:'column', alignment:['fill','top'], \
    g01: Group { orientation:'row', \
    renderSetting: DropDownList {}, \
    outputSetting: DropDownList {}, \
    }, \
    g02: Group { orientation:'row', alignment:['fill','fill'],\
    outputPath: StaticText {text: 'Output to:', alignment:['left','left']}, \
    outputPathBox: EditText {text: 'Path here', alignment:['fill','fill']}, \
    changeOutputPath: Button {text: 'Change', alignment:['right','right']}, \
    }, \
    g03: Group { orientation:'row', alignment:['fill','fill'],\
    keepOriginal: Checkbox {text: 'Keep original', alignment:['left','left']}, \
    }, \
    }, \
    }";

    my_palette.margins = [10, 10, 10, 10];
    my_palette.grp = my_palette.add(res);

    In a floatable panel it’s easy to add buttons like g01.add(“button”,undefined, “Are you sure?”); but how can I do this with the code above?

    Xavier Gomez replied 12 years ago 2 Members · 1 Reply
  • 1 Reply
  • Xavier Gomez

    May 22, 2014 at 3:49 pm

    Hi Jacob,
    you just need to use the add/remove methods of your groups/dropdowns.

    var myDD = my_palette.grp.firstRow.g01.renderSettings;
    // remove all items:
    while (myDD.items.length) myDD.remove(myDD.items[0]);
    // add new
    myDD.add(“item”, “new menu item”);
    // etc

    Same for groups, but in that case, if you don’t specify the new widget location/size, or bounds, you need to run the autolayout after the change:
    myPalette.layout.layout(true);

    Xavier.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy