2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Photoshop | DropDownListにアイテムの追加、削除を行う

2
Posted at
# target photoshop

var GUI_TEST = GUI_TEST || {};

(function() {
    var layout = "dialog { text: 'GUI TEST', \
        ddlst: DropDownList { properties: { items: ['0', '1', '2'] } } \
        txt: StaticText { size: [65, 11], alignment: 'center' } \
        pnl: Panel { text: 'リストの操作', alignChildren: 'fill', \
            btn1: Button { text: '追加', helpTip: 'リストを追加します' } \
            btn2: Button { text: '削除', helpTip: 'リストから1つ削除します' } \
            btn3: Button { text: '全クリア', helpTip: 'リストをすべて削除します' } \
        } \
    }";

    var win = new Window(layout);

    // 最初は1を選択する
    win.ddlst.selection = 1;

    // 追加ボタンが押された
    win.pnl.btn1.onClick = function() {
        var num = win.ddlst.items.length
        win.ddlst.add('item', num);
    };

    // 削除ボタンが押された
    win.pnl.btn2.onClick = function() {
        var len = win.ddlst.items.length;
        if (len > 0)
            win.ddlst.remove(len - 1);
    };

    // 全クリアボタンが押された
    win.pnl.btn3.onClick = function() {
        win.ddlst.removeAll();
    };

    // ドロップダウンリストが選択された
    win.ddlst.onChange = function() {
        win.txt.text = win.ddlst.selection + 'を選択した';
    };

    win.show();
}).apply(GUI_TEST);
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?