UI. How to add or remove controls dynamically?

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

Tokis

UI. How to add or remove controls dynamically?

Post by Tokis »

Hi, guys!
Is it possible to make the dialog box that by anycontrol.OnClick() add or remove another controls? How?

Thanx!


(sorry google translate )
csuebele

UI. How to add or remove controls dynamically?

Post by csuebele »

Do you mean something like this:

Code: Select all#target photoshop

var showControl = true;

redrawDlg()

function redrawDlg(){
    dlg = new Window('dialog','test control');
    if(showControl){dlg.radio1 = dlg.add('radiobutton',undefined,'radio button 1');}
    dlg.radio2 = dlg.add('radiobutton',undefined,'radio button 2');
    dlg.button = dlg.add('button',undefined,'Hide/Show');
    dlg.button.onClick = function(){
        showControl = showControl == false;
        dlg.close()
        redrawDlg ()
        }
    dlg.show();   
    }